`: The RCS service returned an unrecognized
+ status code, where `` is the raw value.
+
+
+ **Service-level errors:**
+
+ - `MISSING_FROM_RESPONSE`: The phone number was absent from the RCS
+ service response.
+
+ - `RCS_SERVICE_UNAVAILABLE`: An exception was thrown during the async
+ RCS service call.
+
+ - `RCS_SERVICE_DISABLED`: RCS lookup is disabled in configuration.
+
+ - `EMPTY_RESPONSE`: The RCS service returned a null or empty response
+ body.
+ example: RCS_SERVICE_UNAVAILABLE
+ lookupResult:
+ type: object
+ description: Carrier information results for the specified telephone number.
+ properties:
+ phoneNumber:
+ type: string
+ description: The telephone number in E.164 format.
+ example: '+10072904498'
+ lineType:
+ $ref: '#/components/schemas/lineTypeEnum'
+ messagingProvider:
+ type: string
+ description: The messaging service provider of the telephone number.
+ example: Verizon Wireless
+ voiceProvider:
+ type: string
+ description: The voice service provider of the telephone number.
+ example: Verizon Wireless
+ countryCodeA3:
+ type: string
+ description: >-
+ The country code of the telephone number in ISO 3166-1 alpha-3
+ format.
+ example: USA
+ deactivationReporter:
+ type: string
+ description: >
+ [DNI-Only](#section/DNI-Only).
+
+ The carrier that reported a deactivation event for this phone
+ number.
+ deactivationDate:
+ type: string
+ format: date-time-local
+ description: >-
+ [DNI-Only](#section/DNI-Only). The datetime the carrier reported a
+ deactivation event.
+ example: 2025-06-20 18:35
+ deactivationEvent:
+ $ref: '#/components/schemas/deactivationEventEnum'
+ latestMessageDeliveryStatus:
+ $ref: '#/components/schemas/latestMessageDeliveryStatusEnum'
+ initialMessageDeliveryStatusDate:
+ type: string
+ format: date
+ description: >-
+ [DNI-Only](#section/DNI-Only). The date the phone number entered the
+ status described in `latestMessageDeliveryStatus`.
+
+ Think of this as the "start time" for that status.
+
+ Value resets every time the `latestMessageDeliveryStatus` changes.
+ example: '2025-06-20'
+ latestMessageDeliveryStatusDate:
+ type: string
+ format: date
+ description: >-
+ [DNI-Only](#section/DNI-Only). The date bandwidth last received
+ delivery status information for this phone number.
+
+ Use this field to understand how up-to-date the
+ `latestMessageDeliveryStatus` is.
+
+ Value resets every time the `latestMessageDeliveryStatus` changes.
+ example: '2025-06-21'
+ rcsEnabled:
+ type: boolean
+ description: >
+ [RCS-Only](#section/RCS-Only). Indicates whether the phone number is
+ capable of receiving RCS messages. Value will be null if account has
+ RCS, but no value was returned. Absent when account does not have
+ RCS.
+ example: true
+ accountId1:
+ type: string
+ description: User's account ID.
+ example: '1234567'
+ tfPhoneNumber:
+ type: string
+ description: Toll-free telephone number in E.164 format.
+ minLength: 12
+ maxLength: 12
+ nullable: false
+ pattern: ^\+1(800|833|844|855|866|877|888)[2-9]\d{6}$
+ example: '+18005555555'
+ tfvWebhookErrors:
+ type: array
+ description: Details of the errors that were encountered when processing the request.
+ items:
+ type: string
+ example: 'optInWorkflowImageURLs: Entries must be a valid array of objects.'
+ tfvCallbackStatusEnum:
+ type: string
+ enum:
+ - VERIFIED
+ - UNVERIFIED
+ example: VERIFIED
+ tfvUnverifiedStatus:
+ type: string
+ default: UNVERIFIED
+ example: UNVERIFIED
+ declineReasonDescription:
+ type: string
+ description: Explanation for why a verification request was declined.
+ nullable: false
+ example: >-
+ Invalid Information - Can't Validate URL - Website is not accessible /
+ not available
+ denialStatusCode:
+ description: Reason code for denial.
+ type: integer
+ example: 511
+ denialStatusCodeNullable:
+ description: Reason code for denial.
+ nullable: true
+ type: integer
+ example: 511
+ resubmitAllowed:
+ description: >-
+ Whether a Toll-Free Verification request qualifies for resubmission via
+ PUT.
+ example: true
+ type: boolean
+ additionalDenialReason:
+ type: object
+ properties:
+ statusCode:
+ $ref: '#/components/schemas/denialStatusCode'
+ reason:
+ $ref: '#/components/schemas/declineReasonDescription'
+ resubmitAllowed:
+ $ref: '#/components/schemas/resubmitAllowed'
+ required:
+ - statusCode
+ - reason
+ - resubmitAllowed
+ blocked:
+ description: >-
+ Whether a Toll-Free Verification is blocked. This attribute will only be
+ defined when the number is blocked.
+ example: true
+ type: boolean
+ blockedReason:
+ description: >-
+ The reason why the Toll-Free Verification is blocked. This attribute
+ will only be defined when the number is blocked.
+ example: Toll-free number was used to send spam messages
+ type: string
+ privacyPolicyUrl:
+ description: The Toll-Free Verification request privacy policy URL.
+ maxLength: 500
+ example: http://your-company.com/privacyPolicy
+ type: string
+ termsAndConditionsUrl:
+ description: The Toll-Free Verification request terms and conditions policy URL.
+ maxLength: 500
+ example: http://your-company.com/termsAndConditions
+ type: string
+ businessDba:
+ description: The company 'Doing Business As'.
+ maxLength: 500
+ example: Another Company Name Inc.
+ type: string
+ businessRegistrationNumber:
+ type: string
+ description: >
+ Government-issued business identifying number.
+
+
+ **Note: As of October 19th, 2026 this field will be required when
+ `businessEntityType` is _not_ `SOLE_PROPRIETOR`. If this field is
+ provided, `businessRegistrationType` and
+ `businessRegistrationIssuingCountry` are also required.**
+ nullable: true
+ maxLength: 500
+ example: 12-3456789
+ businessRegistrationTypeEnum:
+ type: string
+ description: >
+ The type of business registration number.
+
+
+ **Note: As of October 19th, 2026 this field will be required when
+ `businessRegistrationNumber` is provided.**
+ enum:
+ - EIN
+ - CBN
+ - NEQ
+ - PROVINCIAL_NUMBER
+ - CRN
+ - VAT
+ - ACN
+ - ABN
+ - BRN
+ - SIREN
+ - SIRET
+ - NZBN
+ - UST_IDNR
+ - CIF
+ - NIF
+ - CNPJ
+ - UID
+ - OTHER
+ example: EIN
+ nullable: true
+ businessRegistrationIssuingCountry:
+ type: string
+ description: >-
+ The country issuing the business registration in ISO-3166-1 alpha-3
+ format. Alpha-2 format is accepted by the API, but alpha-3 is highly
+ encouraged.
+
+
+ **Note: As of October 19th, 2026 this field will be required when
+ `businessRegistrationNumber` is provided.**
+
+
+ | Registration Type | Supported Countries |
+
+ |----------------------|------------------------------------|
+
+ | EIN | USA |
+
+ | CBN | CAN |
+
+ | NEQ | CAN |
+
+ | PROVINCIAL_NUMBER | CAN |
+
+ | CRN | GBR, HKG |
+
+ | VAT | GBR, IRL, BRA, NLD |
+
+ | ACN | AUS |
+
+ | ABN | AUS |
+
+ | BRN | HKG |
+
+ | SIREN | FRA |
+
+ | SIRET | FRA |
+
+ | NZBN | NZL |
+
+ | UST_IDNR | DEU |
+
+ | CIF | ESP |
+
+ | NIF | ESP |
+
+ | CNPJ | BRA |
+
+ | UID | CHE |
+
+ | OTHER | Must Provide Country Code |
+ example: USA
+ nullable: true
+ businessEntityTypeEnum:
+ type: string
+ description: >
+ The type of registered business.
+
+
+ **Note: As of October 19th, 2026 submissions using a value other than
+ `SOLE_PROPRIETOR` must provide a value for `businessRegistrationNumber`,
+ `businessRegistrationType`, and `businessRegistrationIssuingCountry`.
+
+ Submissions using `SOLE_PROPRIETOR` must _omit_
+ `businessRegistrationNumber`, `businessRegistrationType`, and
+ `businessRegistrationIssuingCountry`. Failure to adhere to these
+ constraints will result in a 400 Bad Request rejection.**
+ enum:
+ - SOLE_PROPRIETOR
+ - PRIVATE_PROFIT
+ - PUBLIC_PROFIT
+ - NON_PROFIT
+ - GOVERNMENT
+ example: PRIVATE_PROFIT
+ nullable: false
+ helpMessageResponse:
+ type: string
+ description: A message that gets sent to users requesting help.
+ nullable: true
+ maxLength: 500
+ example: Please contact support for assistance.
+ ageGatedContent:
+ type: boolean
+ description: Indicates whether the content is age-gated.
+ example: false
+ internalTicketNumber:
+ type: string
+ description: >-
+ Unique identifier (UUID) generated by Bandwidth to assist in tracking
+ the verification status of a toll-free number - included in all webhook
+ payloads.
+ example: acde070d-8c4c-4f0d-9d8a-162843c10333
+ internalTicketNumberForWebhook:
+ type: string
+ description: >-
+ Unique identifier (UUID) generated by Bandwidth to assist in tracking
+ the verification status of a toll-free number.
+ example: acde070d-8c4c-4f0d-9d8a-162843c10333
+ businessContactPhoneNumber:
+ description: Contact telephone number
+ type: string
+ minLength: 1
+ maxLength: 500
+ nullable: false
+ example: '+19192654500'
+ verificationRequest:
+ type: object
+ required:
+ - businessAddress
+ - businessContact
+ - messageVolume
+ - phoneNumbers
+ - useCase
+ - useCaseSummary
+ - productionMessageContent
+ - optInWorkflow
+ - businessEntityType
+ properties:
+ businessAddress:
+ $ref: '#/components/schemas/address'
+ businessContact:
+ $ref: '#/components/schemas/contact'
+ messageVolume:
+ type: integer
+ description: Estimated monthly volume of messages from the toll-free number.
+ minimum: 10
+ maximum: 10000000
+ example: 10000
+ phoneNumbers:
+ type: array
+ minItems: 1
+ maxItems: 10
+ items:
+ $ref: '#/components/schemas/tfPhoneNumber'
+ useCase:
+ $ref: '#/components/schemas/useCase'
+ useCaseSummary:
+ $ref: '#/components/schemas/useCaseSummary'
+ productionMessageContent:
+ $ref: '#/components/schemas/productionMessageContent'
+ optInWorkflow:
+ $ref: '#/components/schemas/optInWorkflow'
+ additionalInformation:
+ type: string
+ description: Any additional information.
+ minLength: 0
+ maxLength: 500
+ nullable: true
+ example: Any additional information
+ isvReseller:
+ $ref: '#/components/schemas/isvReseller'
+ privacyPolicyUrl:
+ $ref: '#/components/schemas/privacyPolicyUrl'
+ termsAndConditionsUrl:
+ $ref: '#/components/schemas/termsAndConditionsUrl'
+ businessDba:
+ $ref: '#/components/schemas/businessDba'
+ businessRegistrationNumber:
+ $ref: '#/components/schemas/businessRegistrationNumber'
+ businessRegistrationType:
+ $ref: '#/components/schemas/businessRegistrationTypeEnum'
+ businessRegistrationIssuingCountry:
+ $ref: '#/components/schemas/businessRegistrationIssuingCountry'
+ businessEntityType:
+ $ref: '#/components/schemas/businessEntityTypeEnum'
+ helpMessageResponse:
+ $ref: '#/components/schemas/helpMessageResponse'
+ ageGatedContent:
+ $ref: '#/components/schemas/ageGatedContent'
+ cvToken:
+ $ref: '#/components/schemas/cvTokenNullable'
+ verificationUpdateRequest:
+ type: object
+ required:
+ - businessAddress
+ - businessContact
+ - messageVolume
+ - useCase
+ - useCaseSummary
+ - productionMessageContent
+ - optInWorkflow
+ properties:
+ businessAddress:
+ $ref: '#/components/schemas/address'
+ businessContact:
+ $ref: '#/components/schemas/contact'
+ messageVolume:
+ type: integer
+ description: Estimated monthly volume of messages from the toll-free number.
+ minimum: 10
+ maximum: 10000000
+ example: 10000
+ useCase:
+ $ref: '#/components/schemas/useCase'
+ useCaseSummary:
+ $ref: '#/components/schemas/useCaseSummary'
+ productionMessageContent:
+ $ref: '#/components/schemas/productionMessageContent'
+ optInWorkflow:
+ $ref: '#/components/schemas/optInWorkflow'
+ additionalInformation:
+ $ref: '#/components/schemas/additionalInformation'
+ isvReseller:
+ $ref: '#/components/schemas/isvReseller'
+ privacyPolicyUrl:
+ $ref: '#/components/schemas/privacyPolicyUrl'
+ termsAndConditionsUrl:
+ $ref: '#/components/schemas/termsAndConditionsUrl'
+ businessDba:
+ $ref: '#/components/schemas/businessDba'
+ businessRegistrationNumber:
+ $ref: '#/components/schemas/businessRegistrationNumber'
+ businessRegistrationType:
+ $ref: '#/components/schemas/businessRegistrationTypeEnum'
+ businessEntityType:
+ $ref: '#/components/schemas/businessEntityTypeEnum'
+ businessRegistrationIssuingCountry:
+ $ref: '#/components/schemas/businessRegistrationIssuingCountry'
+ helpMessageResponse:
+ $ref: '#/components/schemas/helpMessageResponse'
+ ageGatedContent:
+ $ref: '#/components/schemas/ageGatedContent'
+ cvToken:
+ $ref: '#/components/schemas/cvTokenNullable'
+ tfvBasicAuthentication:
+ type: object
+ properties:
+ username:
+ type: string
+ maxLength: 100
+ example: username
+ password:
+ type: string
+ maxLength: 200
+ example: password
+ required:
+ - username
+ - password
+ webhookSubscriptionRequestSchema:
+ type: object
+ properties:
+ basicAuthentication:
+ $ref: '#/components/schemas/tfvBasicAuthentication'
+ callbackUrl:
+ $ref: '#/components/schemas/webhookUrl'
+ sharedSecretKey:
+ $ref: '#/components/schemas/sharedSecretKey'
+ required:
+ - callbackUrl
+ failureWebhook:
+ type: object
+ properties:
+ accountId:
+ $ref: '#/components/schemas/accountId1'
+ phoneNumber:
+ $ref: '#/components/schemas/tfPhoneNumber'
+ errorCode:
+ type: string
+ description: >-
+ An error code indicating what error was encountered. This code can
+ be interpreted as an HTTP status code in regards to the error that
+ was encountered.
+ example: '400'
+ errorMessage:
+ type: string
+ description: A description of the error that was encountered.
+ example: cannot process request.
+ errors:
+ $ref: '#/components/schemas/tfvWebhookErrors'
+ internalTicketNumber:
+ $ref: '#/components/schemas/internalTicketNumberForWebhook'
+ verificationDenialWebhook:
+ type: object
+ properties:
+ accountId:
+ $ref: '#/components/schemas/accountId1'
+ additionalDenialReasons:
+ description: >-
+ An optional list of denial reasons in addition to
+ declineReasonDescription when multiple reasons apply.
+ type: array
+ items:
+ $ref: '#/components/schemas/additionalDenialReason'
+ example:
+ - statusCode: 512
+ reason: Reason A
+ resubmitAllowed: true
+ - statusCode: 513
+ reason: Reason B
+ resubmitAllowed: true
+ declineReasonDescription:
+ $ref: '#/components/schemas/declineReasonDescription'
+ denialStatusCode:
+ $ref: '#/components/schemas/denialStatusCode'
+ internalTicketNumber:
+ $ref: '#/components/schemas/internalTicketNumberForWebhook'
+ phoneNumber:
+ $ref: '#/components/schemas/tfPhoneNumber'
+ resubmitAllowed:
+ $ref: '#/components/schemas/resubmitAllowed'
+ status:
+ $ref: '#/components/schemas/tfvUnverifiedStatus'
+ blocked:
+ $ref: '#/components/schemas/blocked'
+ blockedReason:
+ $ref: '#/components/schemas/blockedReason'
+ verificationWebhook:
+ type: object
+ properties:
+ accountId:
+ $ref: '#/components/schemas/accountId1'
+ phoneNumber:
+ $ref: '#/components/schemas/tfPhoneNumber'
+ status:
+ $ref: '#/components/schemas/tfvCallbackStatusEnum'
+ internalTicketNumber:
+ $ref: '#/components/schemas/internalTicketNumberForWebhook'
+ blockedWebhook:
+ type: object
+ properties:
+ accountId:
+ $ref: '#/components/schemas/accountId1'
+ phoneNumber:
+ $ref: '#/components/schemas/tfPhoneNumber'
+ status:
+ $ref: '#/components/schemas/tfvCallbackStatusEnum'
+ internalTicketNumber:
+ $ref: '#/components/schemas/internalTicketNumberForWebhook'
+ blocked:
+ $ref: '#/components/schemas/blocked'
+ blockedReason:
+ $ref: '#/components/schemas/blockedReason'
+ tfvSubmissionWrapper:
+ type: object
+ properties:
+ submission:
+ $ref: '#/components/schemas/verificationUpdateRequest'
+ address:
+ type: object
+ nullable: false
+ required:
+ - name
+ - addr1
+ - city
+ - state
+ - zip
+ - url
+ properties:
+ name:
+ type: string
+ description: The name of the business using the toll-free number.
+ minLength: 1
+ maxLength: 500
+ nullable: false
+ example: Bandwidth Inc.
+ addr1:
+ type: string
+ description: The address of the business using the toll-free number.
+ minLength: 1
+ maxLength: 500
+ nullable: false
+ example: 2230 Bandmate Way
+ addr2:
+ type: string
+ description: The address of the business using the toll-free number.
+ minLength: 0
+ maxLength: 500
+ nullable: true
+ example: 2230 Bandmate Way
+ city:
+ type: string
+ description: The city of the business using the toll-free number.
+ minLength: 1
+ maxLength: 500
+ nullable: false
+ example: Raleigh
+ state:
+ type: string
+ description: The state of the business using the toll-free number.
+ minLength: 1
+ maxLength: 500
+ nullable: false
+ example: NC
+ zip:
+ type: string
+ description: The zip of the business using the toll-free number.
+ nullable: false
+ example: '27606'
+ pattern: '[- A-Za-z0-9]{0,500}'
+ url:
+ type: string
+ format: url
+ description: The website of the business using the toll-free number.
+ minLength: 1
+ maxLength: 500
+ nullable: false
+ example: https://www.example.com/path/to/resource
+ additionalInformation:
+ type: string
+ description: Any additional information.
+ minLength: 0
+ maxLength: 500
+ nullable: true
+ example: Any additional information
+ optInWorkflow:
+ type: object
+ nullable: false
+ required:
+ - description
+ - imageUrls
+ properties:
+ description:
+ type: string
+ minLength: 1
+ maxLength: 500
+ nullable: false
+ example: Opt In Flow
+ imageUrls:
+ type: array
+ items:
+ type: string
+ minLength: 1
+ maxLength: 500
+ nullable: false
+ example: https://www.example.com/path/to/resource
+ pattern: >-
+ ^$|(https?:\/\/)?(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,253}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#()?&//=]*)
+ confirmationResponse:
+ type: string
+ minLength: 0
+ maxLength: 500
+ nullable: true
+ example: Thank you for opting in!
+ isvReseller:
+ type: string
+ description: ISV name.
+ minLength: 0
+ maxLength: 500
+ nullable: true
+ example: Test ISV
+ contact:
+ type: object
+ nullable: false
+ required:
+ - firstName
+ - lastName
+ - email
+ - phoneNumber
+ properties:
+ firstName:
+ type: string
+ description: The first name of the business contact using the toll-free number.
+ minLength: 1
+ maxLength: 500
+ nullable: false
+ example: John
+ lastName:
+ type: string
+ description: The last name of the business contact using the toll-free number.
+ minLength: 1
+ maxLength: 500
+ nullable: false
+ example: Doe
+ email:
+ $ref: '#/components/schemas/email'
+ phoneNumber:
+ $ref: '#/components/schemas/businessContactPhoneNumber'
+ email:
+ type: string
+ format: email
+ minLength: 0
+ maxLength: 500
+ nullable: false
+ pattern: >-
+ ^(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9]))\.){3}(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9])|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])$
+ example: foo@bar.com
+ useCases:
+ type: array
+ items:
+ type: string
+ example:
+ - 2FA
+ - App Notifications
+ - Appointments
+ - Auctions
+ - Auto Repair Services
+ - Bank Transfers
+ - Billing
+ - Booking Confirmations
+ - Business Updates
+ - COVID-19 Alerts
+ useCase:
+ type: string
+ description: The category of the use case.
+ minLength: 0
+ maxLength: 500
+ example: 2FA
+ useCaseSummary:
+ type: string
+ description: A general idea of the use case and customer.
+ minLength: 0
+ maxLength: 500
+ nullable: false
+ example: Text summarizing the use case for the toll-free number
+ productionMessageContent:
+ type: string
+ description: Example of message content.
+ minLength: 0
+ maxLength: 500
+ nullable: false
+ example: Production message content
+ webhookSubscriptionsListBody:
+ description: >-
+ A list of all webhook subscriptions registered for this account ID for
+ this particular feature (unpaginated).
+ type: object
+ required:
+ - data
+ properties:
+ links:
+ $ref: '#/components/schemas/linksObject'
+ errors:
+ type: array
+ items:
+ $ref: '#/components/schemas/webhookSubscriptionError'
+ data:
+ items:
+ $ref: '#/components/schemas/webhookSubscription'
+ type: array
+ linksObject:
+ type: object
+ properties:
+ first:
+ description: The first (or only) page of results matching the query.
+ type: string
+ next:
+ description: >-
+ If more results exist than specified by 'size', this link returns
+ the next page of 'size' results.
+ type: string
+ previous:
+ description: >-
+ If the results are more than one page, this link returns the
+ previous page of 'size' results.
+ type: string
+ last:
+ description: >-
+ If more results exist than specified by 'size', this link return the
+ last page of result.
+ type: string
+ webhookSubscriptionError:
+ type: object
+ properties:
+ code:
+ type: integer
+ description:
+ type: string
+ telephoneNumbers:
+ type: array
+ items:
+ $ref: '#/components/schemas/telephoneNumber'
+ telephoneNumber:
+ type: object
+ properties:
+ telephoneNumber:
+ description: Simple Telephone Number.
+ type: string
+ webhookSubscriptionTypeEnum:
+ type: string
+ enum:
+ - TOLLFREE_VERIFICATION_STATUS
+ - MESSAGING_PORTOUT_APPROVAL_STATUS
+ example: TOLLFREE_VERIFICATION_STATUS
+ webhookSubscription:
+ description: >-
+ Information about a webhook that Bandwidth should send upon the
+ completion of event customer has subscribed to.
+ type: object
+ required:
+ - callbackUrl
+ properties:
+ id:
+ type: string
+ example: 7hICGStfAfeGxEq3N0lQwO
+ accountId:
+ type: string
+ example: '1234567'
+ callbackUrl:
+ $ref: '#/components/schemas/webhookUrl'
+ type:
+ $ref: '#/components/schemas/webhookSubscriptionTypeEnum'
+ basicAuthentication:
+ description: >-
+ Basic authentication credentials are not required, but if present,
+ both username and password must be provided.
+ type: object
+ required:
+ - username
+ - password
+ properties:
+ username:
+ type: string
+ maxLength: 100
+ password:
+ type: string
+ maxLength: 200
+ createdDate:
+ type: string
+ format: date-time
+ example: '2023-05-15T13:56:39.965Z'
+ modifiedDate:
+ type: string
+ format: date-time
+ example: '2023-05-15T13:56:39.965Z'
+ webhookUrl:
+ description: >-
+ Callback URL to receive status updates from Bandwidth. When a webhook
+ subscription is registered with Bandwidth under a given account ID, it
+ will be used to send status updates for all requests submitted under
+ that account ID.
+ type: string
+ format: url
+ minLength: 0
+ maxLength: 2000
+ nullable: true
+ example: https://www.example.com/path/to/resource
+ pattern: >-
+ ^$|(https?:\/\/)?(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,253}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#()?&//=]*)
+ tfvError:
+ description: A generic error object.
+ properties:
+ type:
+ type: string
+ example: Error Type
+ description:
+ type: string
+ example: Error Message
+ errors:
+ type: object
+ description: >-
+ Each key of this errors object refers to a field of the submitted
+ object (using dot notation for nested objects), with the field being
+ a key to an array of one or more errors for that field.
+ example:
+ field: error message
+ type: object
+ tfvStatus:
+ type: object
+ properties:
+ phoneNumber:
+ $ref: '#/components/schemas/tfPhoneNumber'
+ status:
+ $ref: '#/components/schemas/tfvStatusEnum'
+ internalTicketNumber:
+ $ref: '#/components/schemas/internalTicketNumber'
+ declineReasonDescription:
+ $ref: '#/components/schemas/declineReasonDescription'
+ denialStatusCode:
+ $ref: '#/components/schemas/denialStatusCodeNullable'
+ additionalDenialReasons:
+ description: >-
+ An optional list of denial reasons in addition to
+ declineReasonDescription when multiple reasons apply.
+ nullable: true
+ type: array
+ items:
+ $ref: '#/components/schemas/additionalDenialReason'
+ example:
+ - statusCode: 512
+ reason: Reason A
+ resubmitAllowed: true
+ - statusCode: 513
+ reason: Reason B
+ resubmitAllowed: true
+ resubmitAllowed:
+ $ref: '#/components/schemas/resubmitAllowed'
+ createdDateTime:
+ type: string
+ description: Date and time the verification request was created.
+ format: date-time
+ example: '2021-06-08T06:45:13.0Z'
+ modifiedDateTime:
+ type: string
+ description: Date and time the verification request was last modified.
+ format: date-time
+ example: '2021-06-08T06:45:13.0Z'
+ submission:
+ $ref: '#/components/schemas/tfvSubmissionInfo'
+ blocked:
+ $ref: '#/components/schemas/blocked'
+ blockedReason:
+ $ref: '#/components/schemas/blockedReason'
+ cvToken:
+ $ref: '#/components/schemas/cvTokenNullable'
+ tfvSubmissionInfo:
+ type: object
+ properties:
+ businessAddress:
+ $ref: '#/components/schemas/address'
+ businessContact:
+ $ref: '#/components/schemas/contact'
+ messageVolume:
+ type: integer
+ description: Estimated monthly volume of messages from the toll-free number.
+ minimum: 10
+ maximum: 10000000
+ example: 10000
+ useCase:
+ $ref: '#/components/schemas/useCase'
+ useCaseSummary:
+ $ref: '#/components/schemas/useCaseSummary'
+ productionMessageContent:
+ $ref: '#/components/schemas/productionMessageContent'
+ optInWorkflow:
+ $ref: '#/components/schemas/optInWorkflow'
+ additionalInformation:
+ $ref: '#/components/schemas/additionalInformation'
+ isvReseller:
+ $ref: '#/components/schemas/isvReseller'
+ privacyPolicyUrl:
+ $ref: '#/components/schemas/privacyPolicyUrl'
+ termsAndConditionsUrl:
+ $ref: '#/components/schemas/termsAndConditionsUrl'
+ businessDba:
+ $ref: '#/components/schemas/businessDba'
+ businessRegistrationNumber:
+ $ref: '#/components/schemas/businessRegistrationNumber'
+ description: Government-issued business identifying number.
+ businessRegistrationType:
+ $ref: '#/components/schemas/businessRegistrationTypeEnum'
+ description: The type of business registration number.
+ businessRegistrationIssuingCountry:
+ $ref: '#/components/schemas/businessRegistrationIssuingCountry'
+ description: >-
+ The country issuing the business registration in ISO-3166-1 alpha-3
+ format.
+ businessEntityType:
+ $ref: '#/components/schemas/businessEntityTypeEnum'
+ description: The type of registered business.
+ tfvStatusEnum:
+ type: string
+ enum:
+ - VERIFIED
+ - UNVERIFIED
+ - PENDING
+ example: VERIFIED
+ sharedSecretKey:
+ description: >-
+ An ASCII string submitted by the user as a shared secret key for
+ generating an HMAC header for callbacks.
+ example: This is my $3cret
+ maxLength: 64
+ minLength: 16
+ nullable: true
+ pattern: ^[ -~]{16,64}$
+ type: string
+ cvTokenNullable:
+ type: string
+ description: >-
+ The token provided by Campaign Verify to validate your political use
+ case. Only required for 527 political organizations. If you are not a
+ 527 political organization, this field should be omitted. Supplying an
+ empty string will likely result in rejection.
+ minLength: 0
+ maxLength: 500
+ nullable: true
+ example: >-
+ cv.user123|sess456|mno|tfree|read_write|X7yZ9aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789aBcDeFgHiJkLmNoPqRsTuVw
+ endpointId:
+ type: string
+ description: The unique ID of the endpoint.
+ example: e-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85
+ endpointStatusEnum:
+ type: string
+ enum:
+ - CONNECTED
+ - DISCONNECTED
+ deviceStatusEnum:
+ type: string
+ enum:
+ - CONNECTED
+ - DISCONNECTED
+ endpointTypeEnum:
+ type: string
+ enum:
+ - WEBRTC
+ endpointDirectionEnum:
+ type: string
+ enum:
+ - INBOUND
+ - OUTBOUND
+ - BIDIRECTIONAL
+ sipCredentials:
+ type: object
+ properties:
+ username:
+ type: string
+ description: The username for the SIP connection.
+ example: username
+ password:
+ type: string
+ description: The password for the SIP connection.
+ example: password
+ sipConnectionMetadata:
+ title: SIP Connection
+ type: object
+ properties:
+ ipAddress:
+ type: string
+ format: ipv4
+ description: The IP address of the SIP connection.
+ example: 192.168.0.0
+ port:
+ type: integer
+ description: The port of the SIP connection.
+ example: 5060
+ credentials:
+ $ref: '#/components/schemas/sipCredentials'
+ uuiHeader:
+ type: string
+ description: The User-to-User Information header for the SIP connection.
+ example: my-uui-header
+ webRtcConnectionMetadata:
+ title: WebRTC Connection
+ type: object
+ endpointToken:
+ type: string
+ description: >-
+ The json web token specific to the endpoint. Used to authenticate the
+ client with the media gateway.
+ example: xxxxx.yyyyy.zzzzz
+ endpointTag:
+ type: string
+ description: A tag for the endpoint.
+ example: my-tag
+ maximum: 1024
+ device:
+ type: object
+ properties:
+ deviceId:
+ type: string
+ description: The unique ID of the device.
+ example: d-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85
+ deviceName:
+ type: string
+ description: The name of the device.
+ maximum: 1024
+ example: David's iPhone
+ status:
+ $ref: '#/components/schemas/deviceStatusEnum'
+ creationTimestamp:
+ type: string
+ format: date-time
+ description: The time the device was created. In ISO-8601 format.
+ example: '2021-01-01T00:00:00Z'
+ required:
+ - deviceId
+ - status
+ - creationTimestamp
+ endpoints:
+ type: object
+ properties:
+ endpointId:
+ $ref: '#/components/schemas/endpointId'
+ type:
+ $ref: '#/components/schemas/endpointTypeEnum'
+ status:
+ $ref: '#/components/schemas/endpointStatusEnum'
+ creationTimestamp:
+ type: string
+ format: date-time
+ description: The time the endpoint was created. In ISO-8601 format.
+ example: '2021-01-01T00:00:00Z'
+ expirationTimestamp:
+ type: string
+ format: date-time
+ description: >-
+ The time the endpoint token will expire. In ISO-8601 format. Tokens
+ last 24 hours.
+ example: '2021-01-02T00:00:00Z'
+ tag:
+ $ref: '#/components/schemas/endpointTag'
+ required:
+ - endpointId
+ - type
+ - status
+ - creationTimestamp
+ - expirationTimestamp
+ endpoint:
+ type: object
+ allOf:
+ - $ref: '#/components/schemas/endpoints'
+ - type: object
+ properties:
+ devices:
+ type: array
+ items:
+ $ref: '#/components/schemas/device'
+ createWebRtcConnectionRequest:
+ allOf:
+ - $ref: '#/components/schemas/createEndpointRequestBase'
+ - type: object
+ properties:
+ connectionMetadata:
+ $ref: '#/components/schemas/webRtcConnectionMetadata'
+ createEndpointRequestBase:
+ type: object
+ properties:
+ type:
+ $ref: '#/components/schemas/endpointTypeEnum'
+ direction:
+ $ref: '#/components/schemas/endpointDirectionEnum'
+ eventCallbackUrl:
+ type: string
+ format: uri
+ description: The URL to send event callbacks to.
+ example: https://myapp.com/callback
+ eventFallbackUrl:
+ type: string
+ format: uri
+ description: The URL to send event fallbacks to.
+ example: https://fallback.myapp.com/callback
+ tag:
+ $ref: '#/components/schemas/endpointTag'
+ required:
+ - type
+ - direction
+ createEndpointRequest:
+ oneOf:
+ - $ref: '#/components/schemas/createWebRtcConnectionRequest'
+ discriminator:
+ propertyName: type
+ mapping:
+ WEBRTC: '#/components/schemas/createWebRtcConnectionRequest'
+ createEndpointResponseData:
+ allOf:
+ - $ref: '#/components/schemas/endpoint'
+ - type: object
+ properties:
+ token:
+ $ref: '#/components/schemas/endpointToken'
+ required:
+ - token
+ endpointEventTypeEnum:
+ type: string
+ enum:
+ - DEVICE_CONNECTED
+ - DEVICE_DISCONNECTED
+ endpointEvent:
+ description: An event that occurred on an endpoint.
+ allOf:
+ - $ref: '#/components/schemas/endpoints'
+ - type: object
+ properties:
+ eventTime:
+ type: string
+ format: date-time
+ description: The time the event occurred. In ISO-8601 format.
+ example: '2021-01-01T00:00:00Z'
+ eventType:
+ $ref: '#/components/schemas/endpointEventTypeEnum'
+ device:
+ $ref: '#/components/schemas/device'
+ required:
+ - eventType
+ - eventTime
+ brtcLink:
+ type: object
+ properties:
+ href:
+ type: string
+ description: The full URL of the link.
+ example: >-
+ https://api.bandwidth.com/v2/accounts/5500123/endpoints/e-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85
+ rel:
+ type: string
+ description: The relationship of the link to the current resource.
+ example: self
+ method:
+ type: string
+ description: The HTTP method to use when making the request.
+ example: GET
+ page:
+ type: object
+ properties:
+ pageSize:
+ type: integer
+ description: The number of items per page.
+ minimum: 0
+ example: 10
+ totalElements:
+ type: integer
+ description: The total number of items.
+ minimum: 0
+ example: 100
+ totalPages:
+ type: integer
+ description: The total number of pages.
+ minimum: 0
+ example: 10
+ pageNumber:
+ type: integer
+ description: The current page number.
+ minimum: 0
+ example: 0
+ required:
+ - pageSize
+ brtcError:
+ type: object
+ properties:
+ id:
+ type: string
+ format: uuid
+ description: A unique identifier for the error.
+ example: 59512d87-7a92-4040-8e4a-78fb772019b9
+ type:
+ type: string
+ description: The type of error.
+ example: resource.not_found
+ description:
+ type: string
+ description: A description of the error.
+ example: The requested resource was not found.
+ code:
+ type: string
+ description: A code that uniquely identifies the error.
+ example: '404'
+ source:
+ $ref: '#/components/schemas/brtcErrorSource'
+ required:
+ - type
+ - description
+ brtcErrorSource:
+ type: object
+ properties:
+ parameter:
+ type: string
+ description: The URI parameter that caused the error.
+ example: accountId
+ field:
+ type: string
+ description: The request body field that caused the error.
+ example: accountId
+ header:
+ type: string
+ description: The header that caused the error.
+ example: Authorization
+ reference:
+ type: string
+ description: >-
+ The resource ID or path to the resource (or non-existent resource)
+ causing the error.
+ example: e-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85
+ listEndpointsResponse:
+ type: object
+ properties:
+ links:
+ type: array
+ items:
+ $ref: '#/components/schemas/brtcLink'
+ page:
+ $ref: '#/components/schemas/page'
+ data:
+ type: array
+ items:
+ $ref: '#/components/schemas/endpoints'
+ errors:
+ type: array
+ items:
+ $ref: '#/components/schemas/brtcError'
+ required:
+ - links
+ - data
+ - errors
+ endpointResponse:
+ type: object
+ properties:
+ links:
+ type: array
+ items:
+ $ref: '#/components/schemas/brtcLink'
+ data:
+ $ref: '#/components/schemas/endpoint'
+ errors:
+ type: array
+ items:
+ $ref: '#/components/schemas/brtcError'
+ required:
+ - links
+ - data
+ - errors
+ createEndpointResponse:
+ type: object
+ properties:
+ links:
+ type: array
+ items:
+ $ref: '#/components/schemas/brtcLink'
+ data:
+ $ref: '#/components/schemas/createEndpointResponseData'
+ errors:
+ type: array
+ items:
+ $ref: '#/components/schemas/brtcError'
+ required:
+ - links
+ - data
+ - errors
+ brtcErrorResponse:
+ type: object
+ properties:
+ links:
+ type: array
+ items:
+ $ref: '#/components/schemas/brtcLink'
+ data:
+ type: object
+ nullable: true
+ additionalProperties: false
+ errors:
+ type: array
+ items:
+ $ref: '#/components/schemas/brtcError'
+ required:
+ - links
+ - data
+ - errors
+ responses:
+ createMessageResponse:
+ description: Accepted
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/message'
+ createMultiChannelMessageResponse:
+ description: Accepted
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/createMultiChannelMessageResponse'
+ listMessagesResponse:
+ description: OK
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/messagesList'
+ getMediaResponse:
+ description: OK
+ content:
+ application/octet-stream:
+ schema:
+ type: string
+ description: Successful Operation
+ format: binary
+ listMediaResponse:
+ description: OK
+ headers:
+ Continuation-Token:
+ description: Continuation token used to retrieve subsequent media.
+ schema:
+ type: string
+ content:
+ application/json:
+ schema:
+ type: array
+ items:
+ $ref: '#/components/schemas/media'
+ messagingBadRequestError:
+ description: Bad Request
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/messagingRequestError'
+ messagingNotAcceptableError:
+ description: Not Acceptable
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/messagingRequestError'
+ createMessageBadRequestError:
+ description: Bad Request
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/createMessageRequestError'
+ messagingUnauthorizedError:
+ description: Unauthorized
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/messagingRequestError'
+ messagingForbiddenError:
+ description: Forbidden
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/messagingRequestError'
+ messagingNotFoundError:
+ description: Not Found
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/messagingRequestError'
+ messagingMethodNotAllowedError:
+ description: Method Not Allowed
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/messagingRequestError'
+ messagingInvalidMediaTypeError:
+ description: Unsupported Media Type
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/messagingRequestError'
+ messagingTooManyRequestsError:
+ description: Too Many Requests
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/messagingRequestError'
+ messagingInternalServerError:
+ description: Internal Server Error
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/messagingRequestError'
+ multiChannelBadRequestError:
+ description: Bad Request
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/multiChannelError'
+ example:
+ links: []
+ data: null
+ errors:
+ - type: request-validation
+ description: >-
+ The 'channelList[0].from' field must contain exactly one
+ telephone number
+ source:
+ field: channelList[0].from
+ multiChannelNotAcceptableError:
+ description: Not Acceptable
+ multiChannelUnauthorizedError:
+ description: Unauthorized
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/multiChannelError'
+ example:
+ links: []
+ data: null
+ errors:
+ - type: unauthorized
+ description: Authentication Failed
+ source: {}
+ multiChannelForbiddenError:
+ description: Forbidden
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/multiChannelError'
+ example:
+ links: []
+ data: null
+ errors:
+ - type: forbidden
+ description: Access Denied
+ source: {}
+ multiChannelNotFoundError:
+ description: Not Found
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/multiChannelError'
+ example:
+ links: []
+ data: null
+ errors:
+ - type: forbidden
+ description: Resource not found.
+ source: {}
+ multiChannelMethodNotAllowedError:
+ description: Method Not Allowed
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/multiChannelError'
+ example:
+ links: []
+ data: null
+ errors:
+ - type: method-not-allowed
+ description: Method 'PUT' not supported for this resource.
+ source: {}
+ multiChannelInvalidMediaTypeError:
+ description: Unsupported Media Type
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/multiChannelError'
+ example:
+ links: []
+ data: null
+ errors:
+ - type: unsupported-content-type
+ description: >-
+ Content-Type 'application/xml;charset=UTF-8' is not supported.
+ Please use 'application/json'
+ source:
+ header: Content-Type
+ multiChannelTooManyRequestsError:
+ description: Too Many Requests
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/multiChannelError'
+ example:
+ links: []
+ data: null
+ errors:
+ - type: rate-limit-exceeded
+ description: >-
+ You have exceeded your rate limit for this endpoint. Please
+ retry later.
+ source: {}
+ multiChannelInternalServerError:
+ description: Internal Server Error
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/multiChannelError'
+ example:
+ links: []
+ data: null
+ errors:
+ - type: internal-server-error
+ description: Internal server error. No further information available
+ source: {}
+ listMessagesTooManyRequestsError:
+ description: Too Many Requests
+ headers:
+ Retry-After:
+ description: The number of seconds to wait before retrying the request.
+ schema:
+ type: integer
+ example: 300
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/messagingRequestError'
+ example:
+ type: rate_limit_exceeded
+ description: >-
+ Rate limit exceeded. Wait for Retry-After time before sending
+ another request.
+ createCallResponse:
+ description: Created
+ headers:
+ Location:
+ description: The URL for further interactions with this call
+ schema:
+ type: string
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/createCallResponse'
+ examples:
+ createCall Response:
+ $ref: '#/components/examples/createCallResponseExample'
+ getCallStateResponse:
+ description: OK
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/callState'
+ updateCallResponse:
+ description: OK
+ listCallsResponse:
+ description: OK
+ content:
+ application/json:
+ schema:
+ type: array
+ items:
+ $ref: '#/components/schemas/callState'
+ getStatisticsResponse:
+ description: OK
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/accountStatistics'
+ updateRecordingResponse:
+ description: OK
+ listCallRecordingsResponse:
+ description: OK
+ content:
+ application/json:
+ schema:
+ type: array
+ items:
+ $ref: '#/components/schemas/callRecordingMetadata'
+ getCallRecordingResponse:
+ description: OK
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/callRecordingMetadata'
+ downloadRecordingMediaResponse:
+ description: OK
+ content:
+ audio/vnd.wave:
+ schema:
+ type: string
+ format: binary
+ audio/mpeg:
+ schema:
+ type: string
+ format: binary
+ getRecordingTranscriptionResponse:
+ description: OK
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/recordingTranscriptions'
+ listTranscriptionsResponse:
+ description: OK
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/callTranscriptionMetadataList'
+ getCallTranscriptionResponse:
+ description: OK
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/callTranscriptionResponse'
+ deleteCallTranscriptionResponse:
+ description: No Content
+ listConferencesResponse:
+ description: OK
+ content:
+ application/json:
+ schema:
+ type: array
+ items:
+ $ref: '#/components/schemas/conference'
+ examples:
+ listConferences Response:
+ $ref: '#/components/examples/listConferencesResponseExample'
+ getConferenceResponse:
+ description: OK
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/conference'
+ getConferenceMemberResponse:
+ description: OK
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/conferenceMember'
+ listConferenceRecordingsResponse:
+ description: OK
+ content:
+ application/json:
+ schema:
+ type: array
+ items:
+ $ref: '#/components/schemas/conferenceRecordingMetadata'
+ getConferenceRecordingResponse:
+ description: OK
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/conferenceRecordingMetadata'
+ voiceBadRequestError:
+ description: Bad Request
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/voiceApiError'
+ examples:
+ badRequestErrorExample:
+ $ref: '#/components/examples/voiceBadRequestErrorExample'
+ voiceUnauthorizedError:
+ description: Unauthorized
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/voiceApiError'
+ examples:
+ unauthorizedErrorExample:
+ $ref: '#/components/examples/voiceUnauthorizedErrorExample'
+ voiceForbiddenError:
+ description: Forbidden
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/voiceApiError'
+ examples:
+ forbiddenErrorExample:
+ $ref: '#/components/examples/voiceForbiddenErrorExample'
+ voiceNotFoundError:
+ description: Not Found
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/voiceApiError'
+ examples:
+ notFoundErrorExample:
+ $ref: '#/components/examples/voiceNotFoundErrorExample'
+ voiceNotAllowedError:
+ description: Method Not Allowed
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/voiceApiError'
+ examples:
+ notAllowedErrorExample:
+ $ref: '#/components/examples/voiceNotAllowedErrorExample'
+ voiceConflictError:
+ description: Conflict
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/voiceApiError'
+ examples:
+ conflictErrorExample:
+ $ref: '#/components/examples/voiceConflictErrorExample'
+ voiceUnsupportedMediaTypeError:
+ description: Unsupported Media Type
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/voiceApiError'
+ examples:
+ tooManyRequestsErrorExample:
+ $ref: '#/components/examples/voiceUnsupportedMediaTypeErrorExample'
+ voiceTooManyRequestsError:
+ description: Too Many Requests
+ headers:
+ Retry-After:
+ description: When you should try your request again.
+ schema:
+ type: string
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/voiceApiError'
+ examples:
+ tooManyRequestsErrorExample:
+ $ref: '#/components/examples/voiceTooManyRequestsErrorExample'
+ voiceInternalServerError:
+ description: Internal Server Error
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/voiceApiError'
+ examples:
+ internalServerErrorExample:
+ $ref: '#/components/examples/voiceInternalServerErrorExample'
+ voiceCodeResponse:
+ description: OK
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/voiceCodeResponse'
+ messagingCodeResponse:
+ description: OK
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/messagingCodeResponse'
+ verifyCodeResponse:
+ description: OK
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/verifyCodeResponse'
+ mfaBadRequestError:
+ description: Bad Request
+ headers: {}
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/mfaRequestError'
+ mfaUnauthorizedError:
+ description: Unauthorized
+ headers: {}
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/mfaUnauthorizedRequestError'
+ mfaForbiddenError:
+ description: Forbidden
+ headers: {}
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/mfaForbiddenRequestError'
+ mfaTooManyRequestsError:
+ description: Too Many Requests
+ headers: {}
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/mfaRequestError'
+ mfaInternalServerError:
+ description: Internal Server Error
+ headers: {}
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/mfaRequestError'
+ createSyncLookupResponse:
+ description: OK
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/createSyncLookupResponse'
+ examples:
+ lookupCompleteWithDniExample:
+ $ref: '#/components/examples/lookupCompleteWithDniExample'
+ lookupCompleteExample:
+ $ref: '#/components/examples/lookupCompleteExample'
+ lookupCompleteWithRcsExample:
+ $ref: '#/components/examples/lookupCompleteWithRcsExample'
+ lookupCompleteWithRcsErrorExample:
+ $ref: '#/components/examples/lookupCompleteWithRcsErrorExample'
+ lookupPartialExample:
+ $ref: '#/components/examples/lookupPartialExample'
+ lookupFailedExample:
+ $ref: '#/components/examples/lookupFailedExample'
+ createAsyncBulkLookupResponse:
+ description: Accepted
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/createAsyncBulkLookupResponse'
+ examples:
+ lookupAcceptedExample:
+ $ref: '#/components/examples/lookupAcceptedExample'
+ getAsyncBulkLookupResponse:
+ description: OK
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/getAsyncBulkLookupResponse'
+ examples:
+ lookupCompleteWithDniExample:
+ $ref: '#/components/examples/lookupCompleteWithDniExample'
+ lookupCompleteExample:
+ $ref: '#/components/examples/lookupCompleteExample'
+ lookupInProgressExample:
+ $ref: '#/components/examples/lookupInProgressExample'
+ lookupPartialExample:
+ $ref: '#/components/examples/lookupPartialExample'
+ lookupFailedExample:
+ $ref: '#/components/examples/lookupFailedExample'
+ tnLookupDefaultResponse:
+ description: Bad Request
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/lookupErrorResponse'
+ examples:
+ badRequest:
+ $ref: '#/components/examples/badRequestExample'
+ unauthorized:
+ $ref: '#/components/examples/unauthorizedExample'
+ forbidden:
+ $ref: '#/components/examples/forbiddenExample'
+ mediaType:
+ $ref: '#/components/examples/unsupportedMediaTypeExample'
+ notFound:
+ $ref: '#/components/examples/notFoundExample'
+ tooManyRequests:
+ $ref: '#/components/examples/tooManyRequestsExample'
+ internalServer:
+ $ref: '#/components/examples/internalServerErrorExample'
+ getTollFreeVerificationStatusResponse:
+ description: OK
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/tfvStatus'
+ listWebhookSubscriptionsResponse:
+ description: OK
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/webhookSubscriptionsListBody'
+ createWebhookSubscriptionResponse:
+ description: Created
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/webhookSubscription'
+ updateWebhookSubscriptionResponse:
+ description: OK
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/webhookSubscription'
+ listTollFreeUseCasesResponse:
+ description: OK
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/useCases'
+ tfvBadRequestResponse:
+ description: Bad Request
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/tfvError'
+ example:
+ description: Cannot process request.
+ type: bad request
+ noContentResponse:
+ description: No Content
+ tfvPostBadRequestResponse:
+ description: Bad Request
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/tfvError'
+ example:
+ description: cannot process request.
+ errors:
+ businessName: Business name is required.
+ businessContactEmail: Business contact email is not a valid email address.
+ optInWorkflowImageURLs: Entries must be a valid array of objects.
+ tfvUnauthorizedResponse:
+ description: Unauthorized
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/tfvError'
+ example:
+ description: Client is providing incorrect or invalid credentials.
+ type: unauthorized
+ tfvForbiddenResponse:
+ description: Forbidden
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/tfvError'
+ example:
+ description: Client is not authorized for the action.
+ type: forbidden
+ tfvNotFoundResponse:
+ description: Cannot find the requested resource.
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/tfvError'
+ example:
+ description: Cannot find the requested resource.
+ type: Not Found
+ tfvNotAllowedResponse:
+ description: Method Not Allowed
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/tfvError'
+ example:
+ description: Method is not allowed.
+ type: Method Not Allowed
+ tfvTooManyRequestsResponse:
+ description: Too Many Requests
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/tfvError'
+ example:
+ description: Throttling error. Too many requests.
+ type: Too Many Requests
+ tfvServerErrorResponse:
+ description: Internal Server Error
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/tfvError'
+ example:
+ description: Internal Server Error.
+ type: Internal Server Error
+ tfvServiceUnavailableResponse:
+ description: Service Unavailable
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/tfvError'
+ example:
+ description: Service Unavailable Error.
+ type: Service Unavailable
+ verifyPutResponse:
+ description: Accepted
+ listEndpointsResponse:
+ description: OK
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/listEndpointsResponse'
+ examples:
+ listEndpointsResponseExample:
+ $ref: '#/components/examples/listEndpointsResponseExample'
+ createEndpointResponse:
+ description: Created
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/createEndpointResponse'
+ examples:
+ createEndpointResponseExample:
+ $ref: '#/components/examples/createEndpointResponseExample'
+ getEndpointResponse:
+ description: OK
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/endpointResponse'
+ examples:
+ getEndpointResponseExample:
+ $ref: '#/components/examples/getEndpointResponseExample'
+ badRequestErrorResponse:
+ description: Bad Request
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/brtcErrorResponse'
+ examples:
+ badRequestErrorExample:
+ $ref: '#/components/examples/badRequestErrorExample'
+ unauthorizedErrorResponse:
+ description: Unauthorized
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/brtcErrorResponse'
+ examples:
+ unauthorizedErrorExample:
+ $ref: '#/components/examples/unauthorizedErrorExample'
+ forbiddenErrorResponse:
+ description: Forbidden
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/brtcErrorResponse'
+ examples:
+ forbiddenErrorExample:
+ $ref: '#/components/examples/forbiddenErrorExample'
+ notFoundErrorResponse:
+ description: Not Found
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/brtcErrorResponse'
+ examples:
+ notFoundErrorExample:
+ $ref: '#/components/examples/notFoundErrorExample'
+ methodNotAllowedErrorResponse:
+ description: Method Not Allowed
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/brtcErrorResponse'
+ examples:
+ methodNotAllowedErrorExample:
+ $ref: '#/components/examples/methodNotAllowedErrorExample'
+ unsupportedMediaTypeErrorResponse:
+ description: Unsupported Media Type
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/brtcErrorResponse'
+ examples:
+ unsuppotedMediaTypeErrorExample:
+ $ref: '#/components/examples/unsupportedMediaTypeErrorExample'
+ tooManyRequestsErrorResponse:
+ description: Too Many Requests
+ headers:
+ Retry-After:
+ description: >-
+ The number of seconds the client should wait before making another
+ request.
+ required: true
+ schema:
+ type: integer
+ example: 900
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/brtcErrorResponse'
+ examples:
+ tooManyRequestsErrorExample:
+ $ref: '#/components/examples/tooManyRequestsErrorExample'
+ serviceUnavailableErrorResponse:
+ description: Service Unavailable
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/brtcErrorResponse'
+ examples:
+ serviceUnavailableErrorExample:
+ $ref: '#/components/examples/serviceUnavailableErrorExample'
+ parameters:
+ accountId:
+ in: path
+ name: accountId
+ required: true
+ schema:
+ type: string
+ description: Your Bandwidth Account ID.
+ example: '9900000'
+ mediaId:
+ in: path
+ name: mediaId
+ required: true
+ description: Media ID to retrieve.
+ example: 14762070468292kw2fuqty55yp2b2/0/bw.png
+ schema:
+ type: string
+ contentType:
+ in: header
+ name: Content-Type
+ style: simple
+ explode: false
+ description: The media type of the entity-body.
+ example: audio/wav
+ schema:
+ type: string
+ cacheControl:
+ in: header
+ name: Cache-Control
+ style: simple
+ explode: false
+ description: >-
+ General-header field is used to specify directives that MUST be obeyed
+ by all caching mechanisms along the request/response chain.
+ example: no-cache
+ schema:
+ type: string
+ continuationToken:
+ in: header
+ name: Continuation-Token
+ description: Continuation token used to retrieve subsequent media.
+ example: >-
+ 1XEi2tsFtLo1JbtLwETnM1ZJ+PqAa8w6ENvC5QKvwyrCDYII663Gy5M4s40owR1tjkuWUif6qbWvFtQJR5/ipqbUnfAqL254LKNlPy6tATCzioKSuHuOqgzloDkSwRtX0LtcL2otHS69hK343m+SjdL+vlj71tT39
+ schema:
+ type: string
+ messageId:
+ in: query
+ name: messageId
+ required: false
+ description: >-
+ The ID of the message to search for. Special characters need to be
+ encoded using URL encoding. Message IDs could come in different formats,
+ e.g., 9e0df4ca-b18d-40d7-a59f-82fcdf5ae8e6 and
+ 1589228074636lm4k2je7j7jklbn2 are valid message ID formats. Note that
+ you must include at least one query parameter.
+ example: 9e0df4ca-b18d-40d7-a59f-82fcdf5ae8e6
+ schema:
+ type: string
+ sourceTn:
+ in: query
+ name: sourceTn
+ required: false
+ description: >-
+ The phone number that sent the message. Accepted values are: a single
+ full phone number a comma separated list of full phone numbers (maximum
+ of 10) or a single partial phone number (minimum of 5 characters e.g.
+ '%2B1919').
+ example: '%2B15554443333'
+ schema:
+ type: string
+ destinationTn:
+ in: query
+ name: destinationTn
+ required: false
+ description: >-
+ The phone number that received the message. Accepted values are: a
+ single full phone number a comma separated list of full phone numbers
+ (maximum of 10) or a single partial phone number (minimum of 5
+ characters e.g. '%2B1919').
+ example: '%2B15554443333'
+ schema:
+ type: string
+ messageStatus:
+ in: query
+ name: messageStatus
+ required: false
+ description: >-
+ The status of the message. One of RECEIVED QUEUED SENDING SENT FAILED
+ DELIVERED ACCEPTED UNDELIVERED.
+ schema:
+ $ref: '#/components/schemas/messageStatusEnum'
+ messageDirection:
+ in: query
+ name: messageDirection
+ required: false
+ description: The direction of the message. One of INBOUND OUTBOUND.
+ schema:
+ $ref: '#/components/schemas/listMessageDirectionEnum'
+ carrierName:
+ in: query
+ name: carrierName
+ required: false
+ description: >-
+ The name of the carrier used for this message. Possible values include
+ but are not limited to Verizon and TMobile. Special characters need to
+ be encoded using URL encoding (i.e. AT&T should be passed as AT%26T).
+ example: Verizon
+ schema:
+ type: string
+ messageType:
+ in: query
+ name: messageType
+ required: false
+ description: The type of message. Either sms or mms.
+ schema:
+ $ref: '#/components/schemas/messageTypeEnum'
+ errorCode:
+ in: query
+ name: errorCode
+ required: false
+ description: The error code of the message.
+ example: 9902
+ schema:
+ type: integer
+ fromDateTime:
+ in: query
+ name: fromDateTime
+ required: false
+ description: >-
+ The start of the date range to search in ISO 8601 format. Uses the
+ message receive time. The date range to search in is currently 14 days.
+ example: 2022-09-14T18:20:16.000Z
+ schema:
+ type: string
+ toDateTime:
+ in: query
+ name: toDateTime
+ required: false
+ description: >-
+ The end of the date range to search in ISO 8601 format. Uses the message
+ receive time. The date range to search in is currently 14 days.
+ example: 2022-09-14T18:20:16.000Z
+ schema:
+ type: string
+ campaignId:
+ in: query
+ name: campaignId
+ required: false
+ description: The campaign ID of the message.
+ example: CJEUMDK
+ schema:
+ type: string
+ fromBwLatency:
+ in: query
+ name: fromBwLatency
+ required: false
+ description: >-
+ The minimum Bandwidth latency of the message in seconds. Only available
+ for accounts with the Advanced Quality Metrics feature enabled.
+ example: 5
+ schema:
+ type: integer
+ bwQueued:
+ in: query
+ name: bwQueued
+ required: false
+ description: >-
+ A boolean value indicating whether the message is queued in the
+ Bandwidth network.
+ example: true
+ schema:
+ type: boolean
+ product:
+ in: query
+ name: product
+ required: false
+ description: Messaging product associated with the message.
+ example: P2P
+ schema:
+ $ref: '#/components/schemas/productTypeEnum'
+ location:
+ in: query
+ name: location
+ required: false
+ description: Location Id associated with the message.
+ example: 123ABC
+ schema:
+ type: string
+ carrierQueued:
+ in: query
+ name: carrierQueued
+ required: false
+ description: >-
+ A boolean value indicating whether the message is queued in the carrier
+ network. Only available for OUTBOUND messages from accounts with the
+ Advanced Quality Metrics feature enabled.
+ example: true
+ schema:
+ type: boolean
+ fromCarrierLatency:
+ in: query
+ name: fromCarrierLatency
+ required: false
+ description: >-
+ The minimum carrier latency of the message in seconds. Only available
+ for OUTBOUND messages from accounts with the Advanced Quality Metrics
+ feature enabled.
+ example: 50
+ schema:
+ type: integer
+ callingNumberCountryA3:
+ in: query
+ name: callingNumberCountryA3
+ required: false
+ description: Calling number country in A3 format.
+ example: USA
+ schema:
+ type: string
+ calledNumberCountryA3:
+ in: query
+ name: calledNumberCountryA3
+ required: false
+ description: Called number country in A3 format.
+ example: USA
+ schema:
+ type: string
+ fromSegmentCount:
+ in: query
+ name: fromSegmentCount
+ required: false
+ description: Segment count (start range).
+ example: 1
+ schema:
+ type: integer
+ toSegmentCount:
+ in: query
+ name: toSegmentCount
+ required: false
+ description: Segment count (end range).
+ example: 3
+ schema:
+ type: integer
+ fromMessageSize:
+ in: query
+ name: fromMessageSize
+ required: false
+ description: Message size (start range).
+ example: 100
+ schema:
+ type: integer
+ toMessageSize:
+ in: query
+ name: toMessageSize
+ required: false
+ description: Message size (end range).
+ example: 120
+ schema:
+ type: integer
+ sort:
+ in: query
+ name: sort
+ required: false
+ description: >-
+ The field and direction to sort by combined with a colon. Direction is
+ either asc or desc.
+ example: sourceTn:desc
+ schema:
+ type: string
+ pageToken:
+ in: query
+ name: pageToken
+ required: false
+ description: A base64 encoded value used for pagination of results.
+ example: gdEewhcJLQRB5
+ schema:
+ type: string
+ limit:
+ in: query
+ name: limit
+ required: false
+ description: >-
+ The maximum records requested in search result. Default 100. The sum of
+ limit and after cannot be more than 10000.
+ schema:
+ type: integer
+ example: 50
+ limitTotalCount:
+ in: query
+ name: limitTotalCount
+ required: false
+ description: >-
+ When set to true, the response's totalCount field will have a maximum
+ value of 10,000. When set to false, or excluded, this will give an
+ accurate totalCount of all messages that match the provided filters. If
+ you are experiencing latency, try using this parameter to limit your
+ results.
+ example: true
+ schema:
+ type: boolean
+ callId:
+ name: callId
+ in: path
+ required: true
+ schema:
+ type: string
+ description: Programmable Voice API Call ID.
+ example: c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85
+ recordingId:
+ name: recordingId
+ in: path
+ required: true
+ schema:
+ type: string
+ description: Programmable Voice API Recording ID.
+ example: r-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85
+ conferenceId:
+ name: conferenceId
+ in: path
+ required: true
+ schema:
+ type: string
+ description: Programmable Voice API Conference ID.
+ example: conf-fe23a767-a75a5b77-20c5-4cca-b581-cbbf0776eca9
+ memberId:
+ name: memberId
+ in: path
+ required: true
+ schema:
+ type: string
+ description: Programmable Voice API Conference Member ID.
+ example: c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85
+ transcriptionId:
+ name: transcriptionId
+ in: path
+ required: true
+ schema:
+ type: string
+ description: Programmable Voice API Transcription ID.
+ example: t-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85
+ to:
+ name: to
+ in: query
+ required: false
+ schema:
+ type: string
+ description: Filter results by the `to` field.
+ example: '%2b19195551234'
+ from:
+ name: from
+ in: query
+ required: false
+ schema:
+ type: string
+ description: Filter results by the `from` field.
+ example: '%2b19195554321'
+ name:
+ name: name
+ in: query
+ required: false
+ schema:
+ type: string
+ description: Filter results by the `name` field.
+ example: my-custom-name
+ minCreatedTime:
+ name: minCreatedTime
+ in: query
+ required: false
+ schema:
+ type: string
+ description: >-
+ Filter results to conferences which have a `createdTime` after or at
+ `minCreatedTime` (in ISO8601 format).
+ example: '2022-06-21T19:13:21Z'
+ maxCreatedTime:
+ name: maxCreatedTime
+ in: query
+ required: false
+ schema:
+ type: string
+ description: >-
+ Filter results to conferences which have a `createdTime` before or at
+ `maxCreatedTime` (in ISO8601 format).
+ example: '2022-06-21T19:13:21Z'
+ minStartTime:
+ name: minStartTime
+ in: query
+ required: false
+ schema:
+ type: string
+ description: >-
+ Filter results to recordings which have a `startTime` after or including
+ `minStartTime` (in ISO8601 format).
+ example: '2022-06-21T19:13:21Z'
+ maxStartTime:
+ name: maxStartTime
+ in: query
+ required: false
+ schema:
+ type: string
+ description: >-
+ Filter results to recordings which have a `startTime` before
+ `maxStartTime` (in ISO8601 format).
+ example: '2022-06-21T19:13:21Z'
+ pageSize:
+ name: pageSize
+ in: query
+ required: false
+ schema:
+ type: integer
+ format: int32
+ minimum: 1
+ maximum: 1000
+ default: 1000
+ description: Specifies the max number of conferences that will be returned.
+ example: 500
+ minStartTimeCalls:
+ name: minStartTime
+ in: query
+ required: false
+ schema:
+ type: string
+ description: >-
+ Filter results to calls which have a `startTime` after or including
+ `minStartTime` (in ISO8601 format).
+ example: '2022-06-21T19:13:21Z'
+ maxStartTimeCalls:
+ name: maxStartTime
+ in: query
+ required: false
+ schema:
+ type: string
+ description: >-
+ Filter results to calls which have a `startTime` before or including
+ `maxStartTime` (in ISO8601 format).
+ example: '2022-06-21T19:13:21Z'
+ pageSizeCalls:
+ name: pageSize
+ in: query
+ required: false
+ schema:
+ type: integer
+ format: int32
+ minimum: 1
+ maximum: 10000
+ default: 1000
+ description: Specifies the max number of calls that will be returned.
+ example: 500
+ pageToken1:
+ name: pageToken
+ in: query
+ required: false
+ schema:
+ type: string
+ description: >-
+ Not intended for explicit use. To use pagination, follow the links in
+ the `Link` header of the response, as indicated in the endpoint
+ description.
+ example: eyJwYWdlVG9rZW4iOiJ0b2tlbiJ9
+ disconnectCause:
+ name: disconnectCause
+ in: query
+ required: false
+ schema:
+ type: string
+ description: Filter results to calls with specified call Disconnect Cause.
+ example: hangup
+ accountId1:
+ in: path
+ name: accountId
+ required: true
+ schema:
+ type: string
+ description: Your Bandwidth Account ID.
+ example: '9900000'
+ requestId:
+ in: path
+ name: requestId
+ required: true
+ schema:
+ type: string
+ format: uuid
+ description: The phone number lookup request ID from Bandwidth.
+ example: 004223a0-8b17-41b1-bf81-20732adf5590
+ tfPhoneNumberPathParam:
+ in: path
+ name: phoneNumber
+ required: true
+ schema:
+ $ref: '#/components/schemas/tfPhoneNumber'
+ description: Valid Toll-Free telephone number in E.164 format.
+ example: '+18885555555'
+ webhookSubscriptionIdPathParam:
+ in: path
+ name: id
+ required: true
+ schema:
+ type: string
+ description: Webhook subscription ID
+ example: 7bt57JcsVYJrN9K1OcV1Nu
+ endpointId:
+ name: endpointId
+ in: path
+ required: true
+ schema:
+ type: string
+ example: e-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85
+ description: BRTC Endpoint ID.
+ endpointType:
+ name: type
+ in: query
+ schema:
+ $ref: '#/components/schemas/endpointTypeEnum'
+ description: The type of endpoint.
+ endpointStatus:
+ name: status
+ in: query
+ schema:
+ $ref: '#/components/schemas/endpointStatusEnum'
+ description: The status of the endpoint.
+ afterCursor:
+ name: afterCursor
+ in: query
+ schema:
+ type: string
+ example: TWF5IHRoZSBmb3JjZSBiZSB3aXRoIHlvdQ==
+ description: >-
+ The cursor to use for pagination. This is the value of the `next` link
+ in the previous response.
+ limit1:
+ name: limit
+ in: query
+ schema:
+ type: integer
+ minimum: 1
+ maximum: 1000
+ default: 100
+ example: 2
+ description: The maximum number of endpoints to return in the response.
+ examples:
+ smsMessageReceivedCallbackExample:
+ summary: An example of a sms message-received callback body.
+ 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
+ messageSentCallbackExample:
+ summary: An example of a message-sent callback body.
+ value:
+ time: '2024-06-25T18:42:36.979456Z'
+ type: message-sent
+ to: '+15554443333'
+ description: Message sent 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: v2 lab
+ 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 handset.
+ 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 handset.
+ 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 handset.
+ 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: Number Lookup Request
+ value:
+ phoneNumbers:
+ - '+19196104423'
+ multipleNumberRequestExample:
+ summary: Number Lookup Request for Multiple Numbers
+ value:
+ phoneNumbers:
+ - '+19196104423'
+ - '+19196104424'
+ rcsAgentRequestExample:
+ summary: Number Lookup Request with Custom RCS Agent
+ value:
+ phoneNumbers:
+ - '+19196104423'
+ - '+19196104424'
+ rcsAgent: MyCustomRcsAgent
+ lookupAcceptedExample:
+ summary: Numbers Lookup Accepted
+ value:
+ links:
+ - href: >-
+ /accounts/9912345/phoneNumberLookup/bulk/004223a0-8b17-41b1-bf81-20732adf5590
+ rel: createdRequest
+ method: GET
+ data:
+ requestId: 004223a0-8b17-41b1-bf81-20732adf5590
+ status: IN_PROGRESS
+ results: []
+ errors: []
+ lookupInProgressExample:
+ summary: Numbers Lookup In Progress
+ value:
+ links: []
+ data:
+ requestId: 004223a0-8b17-41b1-bf81-20732adf5590
+ status: IN_PROGRESS
+ results: []
+ errors: []
+ lookupFailedExample:
+ summary: Numbers Lookup Failed
+ value:
+ links: []
+ data:
+ requestId: 004223a0-8b17-41b1-bf81-20732adf5590
+ status: FAILED
+ results: []
+ errors:
+ - code: NO-MATCH
+ description: The following TNs could not be found in the Number Industry data
+ meta:
+ phoneNumbers:
+ - '+13992077164'
+ message: Invalid TNs
+ code: 1001
+ type: NumberInventory
+ lookupPartialExample:
+ summary: Numbers Lookup Partial Complete
+ value:
+ links: []
+ data:
+ requestId: 004223a0-8b17-41b1-bf81-20732adf5590
+ status: PARTIAL_COMPLETE
+ results:
+ - phoneNumber: '+19196104423'
+ lineType: MOBILE
+ messagingProvider: Verizon Wireless
+ voiceProvider: Verizon Wireless
+ countryCodeA3: USA
+ - phoneNumber: '+19196104424'
+ lineType: MOBILE
+ messagingProvider: T-Mobile USA
+ voiceProvider: T-Mobile USA
+ countryCodeA3: USA
+ errors:
+ - code: NO-MATCH
+ description: The following TNs could not be found in the Number Industry data
+ meta:
+ phoneNumbers:
+ - '+13992077164'
+ message: Invalid TNs
+ code: 1001
+ type: NumberInventory
+ lookupCompleteExample:
+ summary: Numbers Lookup Complete (without DNI)
+ value:
+ links: []
+ data:
+ requestId: 004223a0-8b17-41b1-bf81-20732adf5590
+ status: COMPLETE
+ results:
+ - phoneNumber: '+10072904497'
+ lineType: MOBILE
+ messagingProvider: Verizon Wireless
+ voiceProvider: Verizon Wireless
+ countryCodeA3: USA
+ - phoneNumber: '+10072904498'
+ lineType: MOBILE
+ messagingProvider: T-Mobile USA
+ voiceProvider: T-Mobile USA
+ countryCodeA3: USA
+ errors: []
+ lookupCompleteWithDniExample:
+ summary: Numbers Lookup Complete (with DNI)
+ value:
+ links: []
+ data:
+ requestId: 20732adf-bf81-8b17-41b1-004223a05590
+ status: COMPLETE
+ results:
+ - phoneNumber: '+10072904497'
+ countryCodeA3: USA
+ lineType: MOBILE
+ messagingProvider: T-MOBILE USA INC
+ voiceProvider: T-MOBILE USA INC
+ latestMessageDeliveryStatus: ACTIVE
+ initialMessageDeliveryStatusDate: '2025-05-14'
+ latestMessageDeliveryStatusDate: '2025-05-18'
+ - phoneNumber: '+10072904498'
+ countryCodeA3: USA
+ lineType: MOBILE
+ voiceProvider: VERIZON
+ latestMessageDeliveryStatus: DEACTIVATED
+ initialMessageDeliveryStatusDate: '2025-09-05'
+ latestMessageDeliveryStatusDate: '2025-09-05'
+ - phoneNumber: '+10072904499'
+ lineType: MOBILE
+ countryCodeA3: USA
+ messagingProvider: VERIZON
+ voiceProvider: VERIZON
+ deactivationReporter: Verizon Wireless
+ deactivationDate: '2025-09-29 01:23:00'
+ deactivationEvent: DEACTIVATED
+ latestMessageDeliveryStatus: UNKNOWN
+ - phoneNumber: '+10072904500'
+ lineType: FIXED
+ countryCodeA3: USA
+ voiceProvider: VERIZON
+ deactivationReporter: Verizon Wireless
+ deactivationDate: '2025-09-29 01:23:00'
+ deactivationEvent: DEACTIVATED
+ latestMessageDeliveryStatus: NOT_ENABLED
+ errors: []
+ lookupCompleteWithRcsExample:
+ summary: Numbers Lookup Complete (with RCS)
+ value:
+ links: []
+ data:
+ requestId: 004223a0-8b17-41b1-bf81-20732adf5590
+ status: COMPLETE
+ results:
+ - phoneNumber: '+10072904497'
+ lineType: MOBILE
+ messagingProvider: Verizon Wireless
+ voiceProvider: Verizon Wireless
+ countryCodeA3: USA
+ rcsEnabled: true
+ - phoneNumber: '+10072904498'
+ lineType: MOBILE
+ messagingProvider: T-Mobile USA
+ voiceProvider: T-Mobile USA
+ countryCodeA3: USA
+ rcsEnabled: false
+ errors: []
+ lookupCompleteWithRcsErrorExample:
+ summary: Numbers Lookup Complete (with RCS error)
+ value:
+ links: []
+ data:
+ requestId: 004223a0-8b17-41b1-bf81-20732adf5590
+ status: COMPLETE
+ results:
+ - phoneNumber: '+10072904497'
+ lineType: MOBILE
+ messagingProvider: Verizon Wireless
+ voiceProvider: Verizon Wireless
+ countryCodeA3: USA
+ - phoneNumber: '+10072904498'
+ lineType: MOBILE
+ messagingProvider: T-Mobile USA
+ voiceProvider: T-Mobile USA
+ countryCodeA3: USA
+ errors:
+ - code: RCS_SERVICE_UNAVAILABLE
+ type: rcs-error
+ description: An exception was thrown during the async RCS service call.
+ meta:
+ phoneNumbers:
+ - '+10072904497'
+ - code: MISSING_FROM_RESPONSE
+ type: rcs-error
+ description: The phone number was absent from the RCS service response.
+ meta:
+ phoneNumbers:
+ - '+10072904498'
+ badRequestExample:
+ summary: Example Bad Request Error
+ value:
+ links: []
+ data: {}
+ errors:
+ - type: bad-request
+ description: >-
+ Bad Request. Ensure that you have set the requestId as a URL path
+ parameter.
+ unauthorizedExample:
+ summary: Unauthorized Error
+ value:
+ links: []
+ data: {}
+ errors:
+ - type: Unauthorized
+ description: You are not authorized to access this resource.
+ code: '1'
+ page: null
+ forbiddenExample:
+ summary: Forbidden Error
+ value:
+ links: []
+ data: {}
+ errors:
+ - type: Forbidden
+ description: You do not have permission to access this resource.
+ code: '2'
+ page: null
+ unsupportedMediaTypeExample:
+ summary: Unsupported Media Type Error
+ value:
+ links: []
+ data: {}
+ errors:
+ - type: invalid-content-type
+ description: >-
+ Invalid content-type. Ensure that your content-type header is set
+ to application/json.
+ notFoundExample:
+ summary: Not Found Error
+ value:
+ links: []
+ data: {}
+ errors:
+ - type: not-found
+ description: >-
+ RequestId not found. Ensure that the requestId used in the URL
+ path is valid and maps to a previous request that was submitted.
+ tooManyRequestsExample:
+ summary: Too Many Requests Error
+ value:
+ links: []
+ data: {}
+ errors:
+ - type: rate-limiting
+ description: >-
+ Rate limit exceeded. Wait for the time specified in the
+ Retry-After header before sending another request.
+ internalServerErrorExample:
+ summary: Internal Server Error
+ value:
+ links: []
+ data: {}
+ errors:
+ - code: '500'
+ type: unexpected-error
+ description: >-
+ Unexpected error. Please contact Bandwidth Support if your
+ requests are receiving this status code for an extended period of
+ time.
+ listEndpointsResponseExample:
+ summary: List Endpoints Paginated Response
+ value:
+ links:
+ - href: >-
+ https://api.bandwidth.com/v2/accounts/5500123/endpoints?type=SIP&status=CONNECTED&limit=2
+ rel: self
+ method: GET
+ - href: >-
+ https://api.bandwidth.com/v2/accounts/5500123/endpoints?type=SIP&status=CONNECTED&limit=2&afterCursor=TWF5IHRoZSBmb3JjZSBiZSB3aXRoIHlvdQ==
+ rel: next
+ method: GET
+ page:
+ pageSize: 2
+ totalElements: 10
+ totalPages: 5
+ pageNumber: 0
+ data:
+ - endpointId: e-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85
+ type: WEBRTC
+ status: CONNECTED
+ creationTimestamp: '2021-01-01T00:00:00Z'
+ expirationTimestamp: '2021-01-02T00:00:00Z'
+ tag: my-tag
+ - endpointId: e-2cb0-4a07-b215-b22865662d85-15ac29a2-1331029c
+ type: WEBRTC
+ status: CONNECTED
+ creationTimestamp: '2021-01-01T00:00:00Z'
+ expirationTimestamp: '2021-01-02T00:00:00Z'
+ tag: my-tag
+ errors: []
+ createEndpointResponseExample:
+ summary: Create Endpoint Response
+ value:
+ links:
+ - href: >-
+ https://api.bandwidth.com/v2/accounts/5500123/endpoints/e-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85
+ rel: endpoint
+ method: GET
+ data:
+ endpointId: e-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85
+ token: xxxxx.yyyyy.zzzzz
+ type: WEBRTC
+ status: CONNECTED
+ creationTimestamp: '2021-01-01T00:00:00Z'
+ expirationTimestamp: '2021-01-02T00:00:00Z'
+ devices: []
+ tag: my-tag
+ errors: []
+ getEndpointResponseExample:
+ summary: Get Endpoint Response
+ value:
+ links:
+ - href: >-
+ https://api.bandwidth.com/v2/accounts/5500123/endpoints/e-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85
+ rel: self
+ method: GET
+ data:
+ endpointId: e-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85
+ type: WEBRTC
+ status: CONNECTED
+ creationTimestamp: '2021-01-01T00:00:00Z'
+ expirationTimestamp: '2021-01-02T00:00:00Z'
+ devices: []
+ tag: my-tag
+ errors: []
+ createSipEndpointRequestExample:
+ summary: SIP Endpoint Example
+ value:
+ type: SIP
+ connectionMetadata:
+ ipAddress: 0.0.0.0
+ port: 3000
+ credentials:
+ username: username
+ password: '********'
+ uuiHeader: 123456;encoding=jwt
+ direction: INBOUND
+ eventCallbackUrl: https://myEventCallbackUrl.com/callbacks/bandwidth
+ eventFallbackUrl: https://fallback.myEventCallbackUrl.com/callbacks/bandwidth
+ tag: '{"myTag": "myTagValue"}'
+ createWeRtcEndpointExample:
+ summary: WebRTC Endpoint Example
+ value:
+ type: WEBRTC
+ direction: BIDIRECTIONAL
+ eventCallbackUrl: https://myEventCallbackUrl.com/callbacks/bandwidth
+ eventFallbackUrl: https://fallback.myEventCallbackUrl.com/callbacks/bandwidth
+ tag: '{"myTag": "myTagValue"}'
+ updateEndpointBxmlRequestExample:
+ summary: Update Endpoint BXML Request Example
+ value:
+ endpointDisconnectedEventExample:
+ summary: Endpoint Disconnected Event
+ value:
+ endpointId: e-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85
+ type: WEBRTC
+ status: DISCONNECTED
+ creationTimestamp: '2021-01-01T00:00:00Z'
+ expirationTimestamp: '2021-01-02T00:00:00Z'
+ eventTime: '2021-01-01T00:00:00Z'
+ eventType: DEVICE_DISCONNECTED
+ tag: my-tag
+ badRequestErrorExample:
+ summary: Bad Request Error Example
+ value:
+ links: []
+ data: null
+ errors:
+ - id: 59512d87-7a92-4040-8e4a-78fb772019b9
+ type: invalid_parameter
+ description: accountId must not contain any characters other than numbers.
+ code: '400'
+ source:
+ parameter: accountId
+ unauthorizedErrorExample:
+ summary: Unauthorized Error Example
+ value:
+ links: []
+ data: null
+ errors:
+ - id: 59512d87-7a92-4040-8e4a-78fb772019b9
+ type: unauthorized
+ description: >-
+ The provided credentials are not authorized to access this
+ resource.
+ code: '401'
+ source:
+ header: Authorization
+ forbiddenErrorExample:
+ summary: Forbidden Error Example
+ value:
+ links: []
+ data: null
+ errors:
+ - id: 59512d87-7a92-4040-8e4a-78fb772019b9
+ type: forbidden
+ description: >-
+ The provided credentials are not authorized to access this
+ resource.
+ code: '403'
+ source:
+ header: Authorization
+ notFoundErrorExample:
+ summary: Not Found Error Example
+ value:
+ links: []
+ data: null
+ errors:
+ - id: 59512d87-7a92-4040-8e4a-78fb772019b9
+ type: resource_not_found
+ description: The requested resource was not found.
+ code: '404'
+ source:
+ reference: e-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85
+ methodNotAllowedErrorExample:
+ summary: Method Not Allowed Error Example
+ value:
+ links: []
+ data: null
+ errors:
+ - id: 59512d87-7a92-4040-8e4a-78fb772019b9
+ type: method_not_allowed
+ description: The requested method is not allowed on this resource.
+ code: '405'
+ source:
+ parameter: accountId
+ unsupportedMediaTypeErrorExample:
+ summary: Unsupported Media Type Error Example
+ value:
+ links: []
+ data: null
+ errors:
+ - id: 59512d87-7a92-4040-8e4a-78fb772019b9
+ type: unsupported_media_type
+ description: The provided media type is not supported.
+ code: '415'
+ source:
+ header: Content-Type
+ tooManyRequestsErrorExample:
+ summary: Too Many Requests Error Example
+ value:
+ links: []
+ data: null
+ errors:
+ - type: too_many_endpoints
+ description: >-
+ Too many endpoints. Please delete an existing endpoint or wait 24
+ hours for an endpoint to be removed.
+ serviceUnavailableErrorExample:
+ summary: Service Unavailable Error Example
+ value:
+ links: []
+ data: null
+ errors:
+ - id: 59512d87-7a92-4040-8e4a-78fb772019b9
+ type: service_unavailable
+ description: The service is currently unavailable.
+ code: '500'
+ requestBodies:
+ createMessageRequest:
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/messageRequest'
+ required: true
+ createMultiChannelMessageRequest:
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/multiChannelMessageRequest'
+ 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:
+ type: string
+ format: binary
+ application/xml:
+ schema:
+ type: string
+ format: binary
+ application/gzip:
+ schema:
+ type: string
+ format: binary
+ application/x-bzip2:
+ schema:
+ type: string
+ format: binary
+ application/x-gzip:
+ schema:
+ type: string
+ format: binary
+ application/smil:
+ schema:
+ type: string
+ format: binary
+ application/javascript:
+ schema:
+ type: string
+ format: binary
+ audio/mp4:
+ schema:
+ type: string
+ format: binary
+ audio/mpeg:
+ schema:
+ type: string
+ format: binary
+ audio/ogg:
+ schema:
+ type: string
+ format: binary
+ audio/flac:
+ schema:
+ type: string
+ format: binary
+ audio/webm:
+ schema:
+ type: string
+ format: binary
+ audio/wav:
+ schema:
+ type: string
+ format: binary
+ audio/amr:
+ schema:
+ type: string
+ format: binary
+ audio/3gpp:
+ schema:
+ type: string
+ format: binary
+ image/bmp:
+ schema:
+ type: string
+ format: binary
+ image/gif:
+ schema:
+ type: string
+ format: binary
+ image/heic:
+ schema:
+ type: string
+ format: binary
+ image/heif:
+ schema:
+ type: string
+ format: binary
+ image/jpeg:
+ schema:
+ type: string
+ format: binary
+ image/pjpeg:
+ schema:
+ type: string
+ format: binary
+ image/png:
+ schema:
+ type: string
+ format: binary
+ image/svg+xml:
+ schema:
+ type: string
+ format: binary
+ image/tiff:
+ schema:
+ type: string
+ format: binary
+ image/webp:
+ schema:
+ type: string
+ format: binary
+ image/x-icon:
+ schema:
+ type: string
+ format: binary
+ text/css:
+ schema:
+ type: string
+ format: binary
+ text/csv:
+ schema:
+ type: string
+ format: binary
+ text/calendar:
+ schema:
+ type: string
+ format: binary
+ text/html:
+ schema:
+ type: string
+ format: binary
+ text/plain:
+ schema:
+ type: string
+ format: binary
+ text/javascript:
+ schema:
+ type: string
+ format: binary
+ text/vcard:
+ schema:
+ type: string
+ format: binary
+ text/vnd.wap.wml:
+ schema:
+ type: string
+ format: binary
+ text/xml:
+ schema:
+ type: string
+ format: binary
+ video/avi:
+ schema:
+ type: string
+ format: binary
+ video/mp4:
+ schema:
+ type: string
+ format: binary
+ video/mpeg:
+ schema:
+ type: string
+ format: binary
+ video/ogg:
+ schema:
+ type: string
+ format: binary
+ video/quicktime:
+ schema:
+ type: string
+ format: binary
+ video/webm:
+ schema:
+ type: string
+ format: binary
+ video/x-ms-wmv:
+ 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
+ required: true
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/createCall'
+ updateCallRequest:
+ description: >-
+ JSON object containing information to redirect an existing call to a new
+ BXML document
+ required: true
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/updateCall'
+ updateCallBxmlRequest:
+ required: true
+ content:
+ application/xml:
+ schema:
+ type: string
+ description: A valid BXML document to replace the call's current BXML.
+ examples:
+ speakSentence:
+ summary: Speak Sentence
+ value: |-
+
+
+ This is a test sentence.
+
+ redirectUrl:
+ summary: Redirect
+ value: |-
+
+
+
+
+ updateCallRecordingRequest:
+ required: true
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/updateCallRecording'
+ transcribeRecordingRequest:
+ required: true
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/transcribeRecording'
+ updateConferenceRequest:
+ required: true
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/updateConference'
+ updateConferenceBxmlRequest:
+ required: true
+ content:
+ application/xml:
+ schema:
+ type: string
+ description: A valid BXML document to replace the call's current BXML.
+ examples:
+ stopRecording:
+ summary: Stop Recording
+ value: |-
+
+
+
+
+ updateConferenceMemberRequest:
+ required: true
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/updateConferenceMember'
+ codeRequest:
+ description: MFA code request body.
+ required: true
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/codeRequest'
+ codeVerify:
+ description: MFA code verify request body.
+ required: true
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/verifyCodeRequest'
+ createSyncLookupRequest:
+ description: Synchronous phone number lookup request.
+ required: true
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/syncLookupRequest'
+ examples:
+ singleNumberRequestExample:
+ $ref: '#/components/examples/singleNumberRequestExample'
+ multipleNumberRequestExample:
+ $ref: '#/components/examples/multipleNumberRequestExample'
+ rcsAgentRequestExample:
+ $ref: '#/components/examples/rcsAgentRequestExample'
+ createAsyncBulkLookupRequest:
+ description: Asynchronous bulk phone number lookup request.
+ required: true
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/asyncLookupRequest'
+ examples:
+ multipleNumberRequestExample:
+ $ref: '#/components/examples/multipleNumberRequestExample'
+ requestTollFreeVerificationRequest:
+ description: Request for verification of a toll-free phone number.
+ required: true
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/verificationRequest'
+ updateTollFreeVerificationRequestRequest:
+ description: Update a request for verification of a toll-free phone number.
+ required: true
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/tfvSubmissionWrapper'
+ verificationWebhookRequest:
+ description: Verification callback status of a toll-free phone number.
+ required: true
+ content:
+ application/json:
+ schema:
+ oneOf:
+ - $ref: '#/components/schemas/verificationWebhook'
+ - $ref: '#/components/schemas/verificationDenialWebhook'
+ - $ref: '#/components/schemas/failureWebhook'
+ - $ref: '#/components/schemas/blockedWebhook'
+ webhookSubscriptionRequest:
+ description: >-
+ Information about a webhook that Bandwidth should send upon the
+ completion of event customer is trying to subscribe to.
+ required: true
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/webhookSubscriptionRequestSchema'
+ createEndpointRequest:
+ required: true
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/createEndpointRequest'
+ examples:
+ createWebRtcEndpointRequestExample:
+ $ref: '#/components/examples/createWeRtcEndpointExample'
+ updateEndpointBxmlRequest:
+ required: true
+ content:
+ application/xml:
+ schema:
+ type: string
+ description: >-
+ The BXML document to update the endpoint with. This BXML document
+ will be executed against the endpoint when it is updated.
+
+ For more information, please refer to our [BXML
+ documentation](/docs/voice/bxml/).
+ examples:
+ updateEndpointBxmlRequestExample:
+ $ref: '#/components/examples/updateEndpointBxmlRequestExample'
+ securitySchemes:
+ Basic:
+ type: http
+ scheme: basic
+ description: >-
+ Basic authentication is a simple authentication scheme built into the
+ HTTP protocol. To use it, send your HTTP requests with an
+ `Authorization` header that contains the word `Basic` followed by a
+ space and a Base64-encoded string `username:password`.
+
+
+ - Example: `Authorization: Basic ZGVtbZpwQDU1dzByZA==`
+ OAuth2:
+ type: oauth2
+ flows:
+ clientCredentials:
+ tokenUrl: https://api.bandwidth.com/api/v1/oauth2/token
+ scopes: {}
+ callbacks:
+ inboundCallback:
+ '{inboundCallbackUrl}':
+ post:
+ requestBody:
+ required: true
+ description: >-
+ This Inbound Message Webhook is an envelope containing either a
+ received (MO) message to your
+
+ message-enabled Bandwidth telephone number or a multichannel
+ client's response to a suggestion response
+
+ or location request.
+
+
The payload type will be one of message-received,
+ suggestion-response, or
+ requested-location-response.
+
+
Note that suggestion-response and
+ requested-location-response callback types are
+ pertinent only for RBM messages sent from the
+ /messages/multiChannel endpoint.
+
+
Please visit Webhooks
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/inboundCallback'
+ examples:
+ smsMessageReceivedCallback:
+ $ref: '#/components/examples/smsMessageReceivedCallbackExample'
+ mmsMessageReceivedCallback:
+ $ref: '#/components/examples/mmsMessageReceivedCallbackExample'
+ responses:
+ '200':
+ description: OK
+ '202':
+ description: Accepted
+ statusCallback:
+ '{statusCallbackUrl}':
+ post:
+ requestBody:
+ required: true
+ 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-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.
+
Please visit Webhooks
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/statusCallback'
+ examples:
+ messageSendingCallback:
+ $ref: '#/components/examples/messageSendingCallbackExample'
+ messageSentCallback:
+ $ref: '#/components/examples/messageSentCallbackExample'
+ smsMessageDeliveredCallback:
+ $ref: '#/components/examples/smsMessageDeliveredCallbackExample'
+ mmsMessageDeliveredCallback:
+ $ref: '#/components/examples/mmsMessageDeliveredCallbackExample'
+ groupMmsMessageDeliveredCallback:
+ $ref: >-
+ #/components/examples/groupMmsMessageDeliveredCallbackExample
+ messageFailedCallback:
+ $ref: '#/components/examples/messageFailedCallbackExample'
+ responses:
+ '200':
+ description: OK
+ '202':
+ description: Accepted
+ tfVerificationStatus:
+ your_url.com/webhookService:
+ post:
+ summary: TFV status updates sent to customer's webhook URL.
+ description: >-
+ Unique webhook URL provided by customers to which Bandwidth sends a
+ POST request to notify customer regarding TFV status updates.
+ operationId: tfvRequest
+ parameters:
+ - description: >-
+ 64-character lowercase hexidecimal HMAC calculated with a shared
+ secret key, the canonicalized request body, and SHA256. It is
+ only included when a shared secret key is set through webhook
+ subscription.
+ example: ca7b9e9816c90d336f5dca529e733354b81535c7af027b81878ac98afb2dbaa2
+ in: header
+ name: x-bandwidth-signature-hmac-sha256
+ schema:
+ type: string
+ requestBody:
+ $ref: '#/components/requestBodies/verificationWebhookRequest'
+ responses:
+ '204':
+ $ref: '#/components/responses/noContentResponse'
+ '400':
+ $ref: '#/components/responses/tfvBadRequestResponse'
+ '401':
+ $ref: '#/components/responses/tfvUnauthorizedResponse'
+ '403':
+ $ref: '#/components/responses/tfvForbiddenResponse'
+ '404':
+ $ref: '#/components/responses/tfvNotFoundResponse'
+ '405':
+ $ref: '#/components/responses/tfvNotAllowedResponse'
+ '429':
+ $ref: '#/components/responses/tfvTooManyRequestsResponse'
+ '500':
+ $ref: '#/components/responses/tfvServerErrorResponse'
+ '503':
+ $ref: '#/components/responses/tfvServiceUnavailableResponse'
+ endpointEvent:
+ '{request.body#/eventCallbackUrl}':
+ post:
+ requestBody:
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/endpointEvent'
+ examples:
+ endpointDisconnectedEventExample:
+ $ref: '#/components/examples/endpointDisconnectedEventExample'
+ responses:
+ '204':
+ description: Event was successfully received.
diff --git a/composer.json b/composer.json
index d0b683a..8291a2d 100644
--- a/composer.json
+++ b/composer.json
@@ -1,33 +1,46 @@
{
- "name": "bandwidth/sdk",
- "type": "library",
- "description": "Bandwidth's set of APIs",
- "keywords": ["bandwidth","API","SDK"],
- "homepage": "https://www.bandwidth.com/",
- "license": "MIT",
+ "name": "bandwidth/php-sdk",
+ "description": "Bandwidth's Communication APIs",
+ "keywords": [
+ "openapitools",
+ "openapi-generator",
+ "openapi",
+ "php",
+ "sdk",
+ "rest",
+ "api"
+ ],
+ "homepage": "https://openapi-generator.tech",
+ "license": "unlicense",
"authors": [
{
- "name": "Bandwidth Inc.",
- "email": "support@bandwidth.com",
- "homepage": "https://www.bandwidth.com/",
- "role": "Owner"
+ "name": "OpenAPI-Generator contributors",
+ "homepage": "https://openapi-generator.tech"
}
],
"require": {
- "ext-SimpleXML": "*",
- "php": ">=8.0.0",
+ "php": "^8.1",
"ext-curl": "*",
"ext-json": "*",
"ext-mbstring": "*",
- "mashape/unirest-php": "~3.0.1",
- "apimatic/jsonmapper": "~1.3.0"
+ "guzzlehttp/guzzle": "^7.4.5",
+ "guzzlehttp/psr7": "^2.0"
},
"require-dev": {
- "phpunit/phpunit": "^9"
+ "friendsofphp/php-cs-fixer": "^3.5",
+ "overtrue/phplint": "^9.0",
+ "phpunit/phpunit": "^9.0"
},
"autoload": {
- "psr-4": {
- "BandwidthLib\\": "src/"
- }
+ "psr-4": { "Bandwidth\\" : "src/" }
+ },
+ "autoload-dev": {
+ "psr-4": { "Bandwidth\\Test\\" : "tests/" }
+ },
+ "scripts": {
+ "test": [
+ "@phplint"
+ ],
+ "phplint": "phplint"
}
}
diff --git a/custom_templates/Configuration.mustache b/custom_templates/Configuration.mustache
new file mode 100644
index 0000000..9626903
--- /dev/null
+++ b/custom_templates/Configuration.mustache
@@ -0,0 +1,736 @@
+partial_header}}
+
+/**
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+ * https://openapi-generator.tech
+ * Do not edit the class manually.
+ */
+
+namespace {{invokerPackage}};
+
+use InvalidArgumentException;
+use GuzzleHttp\Client;
+
+/**
+ * Configuration Class Doc Comment
+ *
+ * @package {{invokerPackage}}
+ * @author OpenAPI Generator team
+ * @link https://openapi-generator.tech
+ */
+class Configuration
+{
+ public const BOOLEAN_FORMAT_INT = 'int';
+ public const BOOLEAN_FORMAT_STRING = 'string';
+
+ /**
+ * @var Configuration|null
+ */
+ private static ?Configuration $defaultConfiguration = null;
+
+ /**
+ * Associate array to store API key(s)
+ *
+ * @var string[]
+ */
+ protected array $apiKeys = [];
+
+ /**
+ * Associate array to store API prefix (e.g. Bearer)
+ *
+ * @var string[]
+ */
+ protected array $apiKeyPrefixes = [];
+
+ /**
+ * Access token for OAuth/Bearer authentication
+ *
+ * @var string
+ */
+ protected string $accessToken = '';
+
+ /**
+ * Client ID for OAuth2 client credentials authentication
+ *
+ * @var string
+ */
+ protected string $clientId = '';
+
+ /**
+ * Client secret for OAuth2 client credentials authentication
+ *
+ * @var string
+ */
+ protected string $clientSecret = '';
+
+ /**
+ * Token endpoint used to fetch an OAuth2 access token
+ *
+ * @var string
+ */
+ protected string $tokenUrl = 'https://api.bandwidth.com/api/v1/oauth2/token';
+
+ /**
+ * Unix timestamp at which the current access token expires
+ *
+ * @var int|null
+ */
+ protected ?int $accessTokenExpiration = null;
+
+ /**
+ * Callable that returns a valid access token. Overrides the static access
+ * token when set. Defaults to an OAuth2 client credentials getter.
+ *
+ * @var \Closure|null
+ */
+ protected ?\Closure $accessTokenGetter = null;
+
+ /**
+ * Boolean format for query string
+ *
+ * @var string
+ */
+ protected string $booleanFormatForQueryString = self::BOOLEAN_FORMAT_INT;
+
+ /**
+ * Username for HTTP basic authentication
+ *
+ * @var string
+ */
+ protected string $username = '';
+
+ /**
+ * Password for HTTP basic authentication
+ *
+ * @var string
+ */
+ protected string $password = '';
+
+ /**
+ * The host
+ *
+ * @var string
+ */
+ protected string $host = '{{basePath}}';
+
+ /**
+ * User agent of the HTTP request, set to "OpenAPI-Generator/{version}/PHP" by default
+ *
+ * @var string
+ */
+ protected string $userAgent = '{{{httpUserAgent}}}{{^httpUserAgent}}OpenAPI-Generator/{{{artifactVersion}}}{{^artifactVersion}}1.0.0{{/artifactVersion}}/PHP{{/httpUserAgent}}';
+
+ /**
+ * Debug switch (default set to false)
+ *
+ * @var bool
+ */
+ protected bool $debug = false;
+
+ /**
+ * Debug file location (log to STDOUT by default)
+ *
+ * @var string
+ */
+ protected string $debugFile = 'php://output';
+
+ /**
+ * Debug file location (log to STDOUT by default)
+ *
+ * @var string
+ */
+ protected string $tempFolderPath;
+
+ /**
+ * Ignore operation specific hosts
+ *
+ * @var bool
+ */
+ protected bool $ignoreOperationHosts = false;
+
+ /**
+ * Constructor
+ */
+ public function __construct()
+ {
+ $this->tempFolderPath = sys_get_temp_dir();
+
+ // Default OAuth2 getter: reuses a cached token until it nears expiry,
+ // otherwise fetches a new one via the client credentials grant.
+ $this->accessTokenGetter = function (): string {
+ $tokenValid = $this->accessToken !== ''
+ && ($this->accessTokenExpiration === null || $this->accessTokenExpiration > time() + 60);
+ if ($tokenValid) {
+ return $this->accessToken;
+ }
+
+ // Fall back to the static token when client credentials aren't set
+ if ($this->clientId === '' || $this->clientSecret === '') {
+ return $this->accessToken;
+ }
+
+ $response = (new Client())->post($this->tokenUrl, [
+ 'headers' => [
+ 'Authorization' => 'Basic ' . base64_encode("{$this->clientId}:{$this->clientSecret}"),
+ 'Content-Type' => 'application/x-www-form-urlencoded',
+ ],
+ 'body' => 'grant_type=client_credentials',
+ 'http_errors' => false,
+ ]);
+
+ if ($response->getStatusCode() !== 200) {
+ throw new \RuntimeException(
+ "Failed to obtain access token: [{$response->getStatusCode()}] " . (string) $response->getBody()
+ );
+ }
+
+ $body = json_decode((string) $response->getBody(), true);
+ $this->accessToken = $body['access_token'];
+ $this->accessTokenExpiration = time() + $body['expires_in'];
+
+ return $this->accessToken;
+ };
+ }
+
+ /**
+ * Sets API key
+ *
+ * @param string $apiKeyIdentifier API key identifier (authentication scheme)
+ * @param string $key API key or token
+ *
+ * @return $this
+ */
+ public function setApiKey(string $apiKeyIdentifier, string $key): static
+ {
+ $this->apiKeys[$apiKeyIdentifier] = $key;
+ return $this;
+ }
+
+ /**
+ * Gets API key
+ *
+ * @param string $apiKeyIdentifier API key identifier (authentication scheme)
+ *
+ * @return null|string API key or token
+ */
+ public function getApiKey(string $apiKeyIdentifier): ?string
+ {
+ return $this->apiKeys[$apiKeyIdentifier] ?? null;
+ }
+
+ /**
+ * Sets the prefix for API key (e.g. Bearer)
+ *
+ * @param string $apiKeyIdentifier API key identifier (authentication scheme)
+ * @param string $prefix API key prefix, e.g. Bearer
+ *
+ * @return $this
+ */
+ public function setApiKeyPrefix(string $apiKeyIdentifier, string $prefix): static
+ {
+ $this->apiKeyPrefixes[$apiKeyIdentifier] = $prefix;
+ return $this;
+ }
+
+ /**
+ * Gets API key prefix
+ *
+ * @param string $apiKeyIdentifier API key identifier (authentication scheme)
+ *
+ * @return null|string
+ */
+ public function getApiKeyPrefix(string $apiKeyIdentifier): ?string
+ {
+ return $this->apiKeyPrefixes[$apiKeyIdentifier] ?? null;
+ }
+
+ /**
+ * Sets the access token for OAuth
+ *
+ * @param string $accessToken Token for OAuth
+ *
+ * @return $this
+ */
+ public function setAccessToken(string $accessToken): static
+ {
+ $this->accessToken = $accessToken;
+ return $this;
+ }
+
+ /**
+ * Gets the access token for OAuth
+ *
+ * Delegates to the access token getter when set, which may fetch or refresh
+ * the token (and can therefore perform a network request). Falls back to the
+ * static access token otherwise.
+ *
+ * @return string Access token for OAuth
+ */
+ public function getAccessToken(): string
+ {
+ if ($this->accessTokenGetter !== null) {
+ return ($this->accessTokenGetter)() ?? '';
+ }
+ return $this->accessToken;
+ }
+
+ /**
+ * Sets the client ID for OAuth2 client credentials authentication
+ *
+ * @param string $clientId Client ID for OAuth2
+ *
+ * @return $this
+ */
+ public function setClientId(string $clientId): static
+ {
+ $this->clientId = $clientId;
+ return $this;
+ }
+
+ /**
+ * Gets the client ID for OAuth2 client credentials authentication
+ *
+ * @return string Client ID for OAuth2
+ */
+ public function getClientId(): string
+ {
+ return $this->clientId;
+ }
+
+ /**
+ * Sets the client secret for OAuth2 client credentials authentication
+ *
+ * @param string $clientSecret Client secret for OAuth2
+ *
+ * @return $this
+ */
+ public function setClientSecret(string $clientSecret): static
+ {
+ $this->clientSecret = $clientSecret;
+ return $this;
+ }
+
+ /**
+ * Gets the client secret for OAuth2 client credentials authentication
+ *
+ * @return string Client secret for OAuth2
+ */
+ public function getClientSecret(): string
+ {
+ return $this->clientSecret;
+ }
+
+ /**
+ * Sets the token endpoint used to fetch an OAuth2 access token
+ *
+ * @param string $tokenUrl Token endpoint URL
+ *
+ * @return $this
+ */
+ public function setTokenUrl(string $tokenUrl): static
+ {
+ $this->tokenUrl = $tokenUrl;
+ return $this;
+ }
+
+ /**
+ * Gets the token endpoint used to fetch an OAuth2 access token
+ *
+ * @return string Token endpoint URL
+ */
+ public function getTokenUrl(): string
+ {
+ return $this->tokenUrl;
+ }
+
+ /**
+ * Sets the access token getter. Set to null to use the static access token.
+ *
+ * @param \Closure|null $accessTokenGetter Callable returning a valid access token
+ *
+ * @return $this
+ */
+ public function setAccessTokenGetter(?\Closure $accessTokenGetter): static
+ {
+ $this->accessTokenGetter = $accessTokenGetter;
+ return $this;
+ }
+
+ /**
+ * Sets boolean format for query string.
+ *
+ * @param string $booleanFormat Boolean format for query string
+ *
+ * @return $this
+ */
+ public function setBooleanFormatForQueryString(string $booleanFormat): static
+ {
+ $this->booleanFormatForQueryString = $booleanFormat;
+
+ return $this;
+ }
+
+ /**
+ * Gets boolean format for query string.
+ *
+ * @return string Boolean format for query string
+ */
+ public function getBooleanFormatForQueryString(): string
+ {
+ return $this->booleanFormatForQueryString;
+ }
+
+ /**
+ * Sets the username for HTTP basic authentication
+ *
+ * @param string $username Username for HTTP basic authentication
+ *
+ * @return $this
+ */
+ public function setUsername(string $username): static
+ {
+ $this->username = $username;
+ return $this;
+ }
+
+ /**
+ * Gets the username for HTTP basic authentication
+ *
+ * @return string Username for HTTP basic authentication
+ */
+ public function getUsername(): string
+ {
+ return $this->username;
+ }
+
+ /**
+ * Sets the password for HTTP basic authentication
+ *
+ * @param string $password Password for HTTP basic authentication
+ *
+ * @return $this
+ */
+ public function setPassword(string $password): static
+ {
+ $this->password = $password;
+ return $this;
+ }
+
+ /**
+ * Gets the password for HTTP basic authentication
+ *
+ * @return string Password for HTTP basic authentication
+ */
+ public function getPassword(): string
+ {
+ return $this->password;
+ }
+
+ /**
+ * Sets the host
+ *
+ * @param string $host Host
+ *
+ * @return $this
+ */
+ public function setHost(string $host): static
+ {
+ $this->host = $host;
+ return $this;
+ }
+
+ /**
+ * Gets the host
+ *
+ * @return string Host
+ */
+ public function getHost(): string
+ {
+ return $this->host;
+ }
+
+ /**
+ * Sets the user agent of the api client
+ *
+ * @param string $userAgent the user agent of the api client
+ *
+ * @throws InvalidArgumentException
+ * @return $this
+ */
+ public function setUserAgent(string $userAgent): static
+ {
+ $this->userAgent = $userAgent;
+ return $this;
+ }
+
+ /**
+ * Gets the user agent of the api client
+ *
+ * @return string user agent
+ */
+ public function getUserAgent(): string
+ {
+ return $this->userAgent;
+ }
+
+ /**
+ * Sets debug flag
+ *
+ * @param bool $debug Debug flag
+ *
+ * @return $this
+ */
+ public function setDebug(bool $debug): static
+ {
+ $this->debug = $debug;
+ return $this;
+ }
+
+ /**
+ * Gets the debug flag
+ *
+ * @return bool
+ */
+ public function getDebug(): bool
+ {
+ return $this->debug;
+ }
+
+ /**
+ * Sets the debug file
+ *
+ * @param string $debugFile Debug file
+ *
+ * @return $this
+ */
+ public function setDebugFile(string $debugFile): static
+ {
+ $this->debugFile = $debugFile;
+ return $this;
+ }
+
+ /**
+ * Gets the debug file
+ *
+ * @return string
+ */
+ public function getDebugFile(): string
+ {
+ return $this->debugFile;
+ }
+
+ /**
+ * Sets the temp folder path
+ *
+ * @param string $tempFolderPath Temp folder path
+ *
+ * @return $this
+ */
+ public function setTempFolderPath(string $tempFolderPath): static
+ {
+ $this->tempFolderPath = $tempFolderPath;
+ return $this;
+ }
+
+ /**
+ * Gets the temp folder path
+ *
+ * @return string Temp folder path
+ */
+ public function getTempFolderPath(): string
+ {
+ return $this->tempFolderPath;
+ }
+
+ /**
+ * Sets the ignore operation specific hosts flag
+ *
+ * @param bool $ignoreOperationHosts Ignore operation specific hosts flag
+ *
+ * @return $this
+ */
+ public function setIgnoreOperationHosts(bool $ignoreOperationHosts): static
+ {
+ $this->ignoreOperationHosts = $ignoreOperationHosts;
+ return $this;
+ }
+
+ /**
+ * Gets the ignore operation specific hosts flag
+ *
+ * @return bool Ignore operation specific hosts flag
+ */
+ public function getIgnoreOperationHosts(): bool
+ {
+ return $this->ignoreOperationHosts;
+ }
+
+ /**
+ * Gets the default configuration instance
+ *
+ * @return Configuration
+ */
+ public static function getDefaultConfiguration(): Configuration
+ {
+ if (self::$defaultConfiguration === null) {
+ self::$defaultConfiguration = new Configuration();
+ }
+
+ return self::$defaultConfiguration;
+ }
+
+ /**
+ * Sets the default configuration instance
+ *
+ * @param Configuration $config An instance of the Configuration Object
+ *
+ * @return void
+ */
+ public static function setDefaultConfiguration(Configuration $config): void
+ {
+ self::$defaultConfiguration = $config;
+ }
+
+ /**
+ * Gets the essential information for debugging
+ *
+ * @return string The report for debugging
+ */
+ public static function toDebugReport(): string
+ {
+ $report = 'PHP SDK ({{invokerPackage}}) Debug Report:' . PHP_EOL;
+ $report .= ' OS: ' . php_uname() . PHP_EOL;
+ $report .= ' PHP Version: ' . PHP_VERSION . PHP_EOL;
+ $report .= ' The version of the OpenAPI document: {{version}}' . PHP_EOL;
+ {{#artifactVersion}}
+ $report .= ' SDK Package Version: {{.}}' . PHP_EOL;
+ {{/artifactVersion}}
+ $report .= ' Temp Folder Path: ' . self::getDefaultConfiguration()->getTempFolderPath() . PHP_EOL;
+
+ return $report;
+ }
+
+ /**
+ * Get API key (with prefix if set)
+ *
+ * @param string $apiKeyIdentifier name of apikey
+ *
+ * @return null|string API key with the prefix
+ */
+ public function getApiKeyWithPrefix(string $apiKeyIdentifier): ?string
+ {
+ $prefix = $this->getApiKeyPrefix($apiKeyIdentifier);
+ $apiKey = $this->getApiKey($apiKeyIdentifier);
+
+ if ($apiKey === null) {
+ return null;
+ }
+
+ if ($prefix === null) {
+ $keyWithPrefix = $apiKey;
+ } else {
+ $keyWithPrefix = $prefix . ' ' . $apiKey;
+ }
+
+ return $keyWithPrefix;
+ }
+
+ /**
+ * Returns an array of host settings
+ *
+ * @return array an array of host settings
+ */
+ public function getHostSettings(): array
+ {
+ return [
+ {{#servers}}
+ [
+ "url" => "{{{url}}}",
+ "description" => "{{{description}}}{{^description}}No description provided{{/description}}",
+ {{#variables}}
+ {{#-first}}
+ "variables" => [
+ {{/-first}}
+ "{{{name}}}" => [
+ "description" => "{{{description}}}{{^description}}No description provided{{/description}}",
+ "default_value" => "{{{defaultValue}}}",
+ {{#enumValues}}
+ {{#-first}}
+ "enum_values" => [
+ {{/-first}}
+ "{{{.}}}"{{^-last}},{{/-last}}
+ {{#-last}}
+ ]
+ {{/-last}}
+ {{/enumValues}}
+ ]{{^-last}},{{/-last}}
+ {{#-last}}
+ ]
+ {{/-last}}
+ {{/variables}}
+ ]{{^-last}},{{/-last}}
+ {{/servers}}
+ ];
+ }
+
+ /**
+ * Returns URL based on host settings, index and variables
+ *
+ * @param array $hostSettings array of host settings, generated from getHostSettings() or equivalent from the API clients
+ * @param int $hostIndex index of the host settings
+ * @param array|null $variables hash of variable and the corresponding value (optional)
+ * @return string URL based on host settings
+ */
+ public static function getHostString(array $hostSettings, int $hostIndex, ?array $variables = null): string
+ {
+ if (null === $variables) {
+ $variables = [];
+ }
+
+ // check array index out of bound
+ if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) {
+ throw new InvalidArgumentException("Invalid index $hostIndex when selecting the host. Must be less than ".count($hostSettings));
+ }
+
+ $host = $hostSettings[$hostIndex];
+ $url = $host["url"];
+
+ // go through variable and assign a value
+ foreach ($host["variables"] ?? [] as $name => $variable) {
+ if (array_key_exists($name, $variables)) { // check to see if it's in the variables provided by the user
+ if (!isset($variable['enum_values']) || in_array($variables[$name], $variable["enum_values"], true)) { // check to see if the value is in the enum
+ $url = str_replace("{".$name."}", $variables[$name], $url);
+ } else {
+ throw new InvalidArgumentException("The variable `$name` in the host URL has invalid value ".$variables[$name].". Must be ".join(',', $variable["enum_values"]).".");
+ }
+ } else {
+ // use default value
+ $url = str_replace("{".$name."}", $variable["default_value"], $url);
+ }
+ }
+
+ return $url;
+ }
+
+ /**
+ * Returns URL based on the index and variables
+ *
+ * @param int $index index of the host settings
+ * @param array|null $variables hash of variable and the corresponding value (optional)
+ * @return string URL based on host settings
+ */
+ public function getHostFromSettings(int $index, ?array $variables = null): string
+ {
+ return self::getHostString($this->getHostSettings(), $index, $variables);
+ }
+}
diff --git a/docs/Api/CallsApi.md b/docs/Api/CallsApi.md
new file mode 100644
index 0000000..b96b9fe
--- /dev/null
+++ b/docs/Api/CallsApi.md
@@ -0,0 +1,399 @@
+# Bandwidth\CallsApi
+
+All URIs are relative to http://localhost, except if the operation defines another base path.
+
+| Method | HTTP request | Description |
+| ------------- | ------------- | ------------- |
+| [**createCall()**](CallsApi.md#createCall) | **POST** /accounts/{accountId}/calls | Create Call |
+| [**getCallState()**](CallsApi.md#getCallState) | **GET** /accounts/{accountId}/calls/{callId} | Get Call State Information |
+| [**listCalls()**](CallsApi.md#listCalls) | **GET** /accounts/{accountId}/calls | Get Calls |
+| [**updateCall()**](CallsApi.md#updateCall) | **POST** /accounts/{accountId}/calls/{callId} | Update Call |
+| [**updateCallBxml()**](CallsApi.md#updateCallBxml) | **PUT** /accounts/{accountId}/calls/{callId}/bxml | Update Call BXML |
+
+
+## `createCall()`
+
+```php
+createCall($account_id, $create_call): \Bandwidth\Model\CreateCallResponse
+```
+### URI(s):
+- https://voice.bandwidth.com/api/v2 Production
+Create Call
+
+Creates an outbound phone call. All calls are initially queued. Your outbound calls will initiated at a specific dequeueing rate, enabling your application to \"fire and forget\" when creating calls. Queued calls may not be modified until they are dequeued and placed, but may be removed from your queue on demand. Please note: Calls submitted to your queue will be placed approximately in order, but exact ordering is not guaranteed.
+
+### Example
+
+```php
+setUsername('YOUR_USERNAME')
+ ->setPassword('YOUR_PASSWORD');
+
+// Configure OAuth2 access token for authorization: OAuth2
+$config = Bandwidth\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
+
+
+$apiInstance = new Bandwidth\Api\CallsApi(
+ // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
+ // This is optional, `GuzzleHttp\Client` will be used as default.
+ new GuzzleHttp\Client(),
+ $config
+);
+$account_id = 9900000; // string | Your Bandwidth Account ID.
+$create_call = new \Bandwidth\Model\CreateCall(); // \Bandwidth\Model\CreateCall | JSON object containing information to create an outbound call
+
+$hostIndex = 0;
+$variables = [
+];
+
+try {
+ $result = $apiInstance->createCall($account_id, $create_call, $hostIndex, $variables);
+ print_r($result);
+} catch (Exception $e) {
+ echo 'Exception when calling CallsApi->createCall: ', $e->getMessage(), PHP_EOL;
+}
+```
+
+### Parameters
+
+| Name | Type | Description | Notes |
+| ------------- | ------------- | ------------- | ------------- |
+| **account_id** | **string**| Your Bandwidth Account ID. | |
+| **create_call** | [**\Bandwidth\Model\CreateCall**](../Model/CreateCall.md)| JSON object containing information to create an outbound call | |
+| hostIndex | null|int | Host index. Defaults to null. If null, then the library will use $this->hostIndex instead | [optional] |
+| variables | array | Associative array of variables to pass to the host. Defaults to empty array. | [optional] |
+
+### Return type
+
+[**\Bandwidth\Model\CreateCallResponse**](../Model/CreateCallResponse.md)
+
+### Authorization
+
+[Basic](../../README.md#Basic), [OAuth2](../../README.md#OAuth2)
+
+### HTTP request headers
+
+- **Content-Type**: `application/json`
+- **Accept**: `application/json`
+
+[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
+[[Back to Model list]](../../README.md#models)
+[[Back to README]](../../README.md)
+
+## `getCallState()`
+
+```php
+getCallState($account_id, $call_id): \Bandwidth\Model\CallState
+```
+### URI(s):
+- https://voice.bandwidth.com/api/v2 Production
+Get Call State Information
+
+Retrieve the current state of a specific call. This information is near-realtime, so it may take a few minutes for your call to be accessible using this endpoint. **Note**: Call information is kept for 7 days after the calls are hung up. If you attempt to retrieve information for a call that is older than 7 days, you will get an HTTP 404 response.
+
+### Example
+
+```php
+setUsername('YOUR_USERNAME')
+ ->setPassword('YOUR_PASSWORD');
+
+// Configure OAuth2 access token for authorization: OAuth2
+$config = Bandwidth\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
+
+
+$apiInstance = new Bandwidth\Api\CallsApi(
+ // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
+ // This is optional, `GuzzleHttp\Client` will be used as default.
+ new GuzzleHttp\Client(),
+ $config
+);
+$account_id = 9900000; // string | Your Bandwidth Account ID.
+$call_id = c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85; // string | Programmable Voice API Call ID.
+
+$hostIndex = 0;
+$variables = [
+];
+
+try {
+ $result = $apiInstance->getCallState($account_id, $call_id, $hostIndex, $variables);
+ print_r($result);
+} catch (Exception $e) {
+ echo 'Exception when calling CallsApi->getCallState: ', $e->getMessage(), PHP_EOL;
+}
+```
+
+### Parameters
+
+| Name | Type | Description | Notes |
+| ------------- | ------------- | ------------- | ------------- |
+| **account_id** | **string**| Your Bandwidth Account ID. | |
+| **call_id** | **string**| Programmable Voice API Call ID. | |
+| hostIndex | null|int | Host index. Defaults to null. If null, then the library will use $this->hostIndex instead | [optional] |
+| variables | array | Associative array of variables to pass to the host. Defaults to empty array. | [optional] |
+
+### Return type
+
+[**\Bandwidth\Model\CallState**](../Model/CallState.md)
+
+### Authorization
+
+[Basic](../../README.md#Basic), [OAuth2](../../README.md#OAuth2)
+
+### HTTP request headers
+
+- **Content-Type**: Not defined
+- **Accept**: `application/json`
+
+[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
+[[Back to Model list]](../../README.md#models)
+[[Back to README]](../../README.md)
+
+## `listCalls()`
+
+```php
+listCalls($account_id, $to, $from, $min_start_time, $max_start_time, $disconnect_cause, $page_size, $page_token): \Bandwidth\Model\CallState[]
+```
+### URI(s):
+- https://voice.bandwidth.com/api/v2 Production
+Get Calls
+
+Returns a max of 10000 calls, sorted by `createdTime` from oldest to newest. **NOTE:** If the number of calls in the account is bigger than `pageSize`, a `Link` header (with format `<{url}>; rel=\"next\"`) will be returned in the response. The url can be used to retrieve the next page of call records. Also, call information is kept for 7 days after the calls are hung up. If you attempt to retrieve information for a call that is older than 7 days, you will get an empty array [] in response.
+
+### Example
+
+```php
+setUsername('YOUR_USERNAME')
+ ->setPassword('YOUR_PASSWORD');
+
+// Configure OAuth2 access token for authorization: OAuth2
+$config = Bandwidth\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
+
+
+$apiInstance = new Bandwidth\Api\CallsApi(
+ // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
+ // This is optional, `GuzzleHttp\Client` will be used as default.
+ new GuzzleHttp\Client(),
+ $config
+);
+$account_id = 9900000; // string | Your Bandwidth Account ID.
+$to = %2b19195551234; // string | Filter results by the `to` field.
+$from = %2b19195554321; // string | Filter results by the `from` field.
+$min_start_time = 2022-06-21T19:13:21Z; // string | Filter results to calls which have a `startTime` after or including `minStartTime` (in ISO8601 format).
+$max_start_time = 2022-06-21T19:13:21Z; // string | Filter results to calls which have a `startTime` before or including `maxStartTime` (in ISO8601 format).
+$disconnect_cause = hangup; // string | Filter results to calls with specified call Disconnect Cause.
+$page_size = 500; // int | Specifies the max number of calls that will be returned.
+$page_token = eyJwYWdlVG9rZW4iOiJ0b2tlbiJ9; // string | Not intended for explicit use. To use pagination, follow the links in the `Link` header of the response, as indicated in the endpoint description.
+
+$hostIndex = 0;
+$variables = [
+];
+
+try {
+ $result = $apiInstance->listCalls($account_id, $to, $from, $min_start_time, $max_start_time, $disconnect_cause, $page_size, $page_token, $hostIndex, $variables);
+ print_r($result);
+} catch (Exception $e) {
+ echo 'Exception when calling CallsApi->listCalls: ', $e->getMessage(), PHP_EOL;
+}
+```
+
+### Parameters
+
+| Name | Type | Description | Notes |
+| ------------- | ------------- | ------------- | ------------- |
+| **account_id** | **string**| Your Bandwidth Account ID. | |
+| **to** | **string**| Filter results by the `to` field. | [optional] |
+| **from** | **string**| Filter results by the `from` field. | [optional] |
+| **min_start_time** | **string**| Filter results to calls which have a `startTime` after or including `minStartTime` (in ISO8601 format). | [optional] |
+| **max_start_time** | **string**| Filter results to calls which have a `startTime` before or including `maxStartTime` (in ISO8601 format). | [optional] |
+| **disconnect_cause** | **string**| Filter results to calls with specified call Disconnect Cause. | [optional] |
+| **page_size** | **int**| Specifies the max number of calls that will be returned. | [optional] [default to 1000] |
+| **page_token** | **string**| Not intended for explicit use. To use pagination, follow the links in the `Link` header of the response, as indicated in the endpoint description. | [optional] |
+| hostIndex | null|int | Host index. Defaults to null. If null, then the library will use $this->hostIndex instead | [optional] |
+| variables | array | Associative array of variables to pass to the host. Defaults to empty array. | [optional] |
+
+### Return type
+
+[**\Bandwidth\Model\CallState[]**](../Model/CallState.md)
+
+### Authorization
+
+[Basic](../../README.md#Basic), [OAuth2](../../README.md#OAuth2)
+
+### HTTP request headers
+
+- **Content-Type**: Not defined
+- **Accept**: `application/json`
+
+[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
+[[Back to Model list]](../../README.md#models)
+[[Back to README]](../../README.md)
+
+## `updateCall()`
+
+```php
+updateCall($account_id, $call_id, $update_call)
+```
+### URI(s):
+- https://voice.bandwidth.com/api/v2 Production
+Update Call
+
+Interrupts and redirects a call to a different URL that should return a BXML document.
+
+### Example
+
+```php
+setUsername('YOUR_USERNAME')
+ ->setPassword('YOUR_PASSWORD');
+
+// Configure OAuth2 access token for authorization: OAuth2
+$config = Bandwidth\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
+
+
+$apiInstance = new Bandwidth\Api\CallsApi(
+ // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
+ // This is optional, `GuzzleHttp\Client` will be used as default.
+ new GuzzleHttp\Client(),
+ $config
+);
+$account_id = 9900000; // string | Your Bandwidth Account ID.
+$call_id = c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85; // string | Programmable Voice API Call ID.
+$update_call = new \Bandwidth\Model\UpdateCall(); // \Bandwidth\Model\UpdateCall | JSON object containing information to redirect an existing call to a new BXML document
+
+$hostIndex = 0;
+$variables = [
+];
+
+try {
+ $apiInstance->updateCall($account_id, $call_id, $update_call, $hostIndex, $variables);
+} catch (Exception $e) {
+ echo 'Exception when calling CallsApi->updateCall: ', $e->getMessage(), PHP_EOL;
+}
+```
+
+### Parameters
+
+| Name | Type | Description | Notes |
+| ------------- | ------------- | ------------- | ------------- |
+| **account_id** | **string**| Your Bandwidth Account ID. | |
+| **call_id** | **string**| Programmable Voice API Call ID. | |
+| **update_call** | [**\Bandwidth\Model\UpdateCall**](../Model/UpdateCall.md)| JSON object containing information to redirect an existing call to a new BXML document | |
+| hostIndex | null|int | Host index. Defaults to null. If null, then the library will use $this->hostIndex instead | [optional] |
+| variables | array | Associative array of variables to pass to the host. Defaults to empty array. | [optional] |
+
+### Return type
+
+void (empty response body)
+
+### Authorization
+
+[Basic](../../README.md#Basic), [OAuth2](../../README.md#OAuth2)
+
+### HTTP request headers
+
+- **Content-Type**: `application/json`
+- **Accept**: `application/json`
+
+[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
+[[Back to Model list]](../../README.md#models)
+[[Back to README]](../../README.md)
+
+## `updateCallBxml()`
+
+```php
+updateCallBxml($account_id, $call_id, $body)
+```
+### URI(s):
+- https://voice.bandwidth.com/api/v2 Production
+Update Call BXML
+
+Interrupts and replaces an active call's BXML document.
+
+### Example
+
+```php
+setUsername('YOUR_USERNAME')
+ ->setPassword('YOUR_PASSWORD');
+
+// Configure OAuth2 access token for authorization: OAuth2
+$config = Bandwidth\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
+
+
+$apiInstance = new Bandwidth\Api\CallsApi(
+ // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
+ // This is optional, `GuzzleHttp\Client` will be used as default.
+ new GuzzleHttp\Client(),
+ $config
+);
+$account_id = 9900000; // string | Your Bandwidth Account ID.
+$call_id = c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85; // string | Programmable Voice API Call ID.
+$body =
+
+ This is a test sentence.
+ ; // string
+
+$hostIndex = 0;
+$variables = [
+];
+
+try {
+ $apiInstance->updateCallBxml($account_id, $call_id, $body, $hostIndex, $variables);
+} catch (Exception $e) {
+ echo 'Exception when calling CallsApi->updateCallBxml: ', $e->getMessage(), PHP_EOL;
+}
+```
+
+### Parameters
+
+| Name | Type | Description | Notes |
+| ------------- | ------------- | ------------- | ------------- |
+| **account_id** | **string**| Your Bandwidth Account ID. | |
+| **call_id** | **string**| Programmable Voice API Call ID. | |
+| **body** | **string**| | |
+| hostIndex | null|int | Host index. Defaults to null. If null, then the library will use $this->hostIndex instead | [optional] |
+| variables | array | Associative array of variables to pass to the host. Defaults to empty array. | [optional] |
+
+### Return type
+
+void (empty response body)
+
+### Authorization
+
+[Basic](../../README.md#Basic), [OAuth2](../../README.md#OAuth2)
+
+### HTTP request headers
+
+- **Content-Type**: `application/xml`
+- **Accept**: `application/json`
+
+[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
+[[Back to Model list]](../../README.md#models)
+[[Back to README]](../../README.md)
diff --git a/docs/Api/ConferencesApi.md b/docs/Api/ConferencesApi.md
new file mode 100644
index 0000000..1d182bd
--- /dev/null
+++ b/docs/Api/ConferencesApi.md
@@ -0,0 +1,704 @@
+# Bandwidth\ConferencesApi
+
+All URIs are relative to http://localhost, except if the operation defines another base path.
+
+| Method | HTTP request | Description |
+| ------------- | ------------- | ------------- |
+| [**downloadConferenceRecording()**](ConferencesApi.md#downloadConferenceRecording) | **GET** /accounts/{accountId}/conferences/{conferenceId}/recordings/{recordingId}/media | Download Conference Recording |
+| [**getConference()**](ConferencesApi.md#getConference) | **GET** /accounts/{accountId}/conferences/{conferenceId} | Get Conference Information |
+| [**getConferenceMember()**](ConferencesApi.md#getConferenceMember) | **GET** /accounts/{accountId}/conferences/{conferenceId}/members/{memberId} | Get Conference Member |
+| [**getConferenceRecording()**](ConferencesApi.md#getConferenceRecording) | **GET** /accounts/{accountId}/conferences/{conferenceId}/recordings/{recordingId} | Get Conference Recording Information |
+| [**listConferenceRecordings()**](ConferencesApi.md#listConferenceRecordings) | **GET** /accounts/{accountId}/conferences/{conferenceId}/recordings | Get Conference Recordings |
+| [**listConferences()**](ConferencesApi.md#listConferences) | **GET** /accounts/{accountId}/conferences | Get Conferences |
+| [**updateConference()**](ConferencesApi.md#updateConference) | **POST** /accounts/{accountId}/conferences/{conferenceId} | Update Conference |
+| [**updateConferenceBxml()**](ConferencesApi.md#updateConferenceBxml) | **PUT** /accounts/{accountId}/conferences/{conferenceId}/bxml | Update Conference BXML |
+| [**updateConferenceMember()**](ConferencesApi.md#updateConferenceMember) | **PUT** /accounts/{accountId}/conferences/{conferenceId}/members/{memberId} | Update Conference Member |
+
+
+## `downloadConferenceRecording()`
+
+```php
+downloadConferenceRecording($account_id, $conference_id, $recording_id): \SplFileObject
+```
+### URI(s):
+- https://voice.bandwidth.com/api/v2 Production
+Download Conference Recording
+
+Downloads the specified recording file.
+
+### Example
+
+```php
+setUsername('YOUR_USERNAME')
+ ->setPassword('YOUR_PASSWORD');
+
+// Configure OAuth2 access token for authorization: OAuth2
+$config = Bandwidth\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
+
+
+$apiInstance = new Bandwidth\Api\ConferencesApi(
+ // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
+ // This is optional, `GuzzleHttp\Client` will be used as default.
+ new GuzzleHttp\Client(),
+ $config
+);
+$account_id = 9900000; // string | Your Bandwidth Account ID.
+$conference_id = conf-fe23a767-a75a5b77-20c5-4cca-b581-cbbf0776eca9; // string | Programmable Voice API Conference ID.
+$recording_id = r-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85; // string | Programmable Voice API Recording ID.
+
+$hostIndex = 0;
+$variables = [
+];
+
+try {
+ $result = $apiInstance->downloadConferenceRecording($account_id, $conference_id, $recording_id, $hostIndex, $variables);
+ print_r($result);
+} catch (Exception $e) {
+ echo 'Exception when calling ConferencesApi->downloadConferenceRecording: ', $e->getMessage(), PHP_EOL;
+}
+```
+
+### Parameters
+
+| Name | Type | Description | Notes |
+| ------------- | ------------- | ------------- | ------------- |
+| **account_id** | **string**| Your Bandwidth Account ID. | |
+| **conference_id** | **string**| Programmable Voice API Conference ID. | |
+| **recording_id** | **string**| Programmable Voice API Recording ID. | |
+| hostIndex | null|int | Host index. Defaults to null. If null, then the library will use $this->hostIndex instead | [optional] |
+| variables | array | Associative array of variables to pass to the host. Defaults to empty array. | [optional] |
+
+### Return type
+
+**\SplFileObject**
+
+### Authorization
+
+[Basic](../../README.md#Basic), [OAuth2](../../README.md#OAuth2)
+
+### HTTP request headers
+
+- **Content-Type**: Not defined
+- **Accept**: `audio/vnd.wave`, `audio/mpeg`, `application/json`
+
+[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
+[[Back to Model list]](../../README.md#models)
+[[Back to README]](../../README.md)
+
+## `getConference()`
+
+```php
+getConference($account_id, $conference_id): \Bandwidth\Model\Conference
+```
+### URI(s):
+- https://voice.bandwidth.com/api/v2 Production
+Get Conference Information
+
+Returns information about the specified conference.
+
+### Example
+
+```php
+setUsername('YOUR_USERNAME')
+ ->setPassword('YOUR_PASSWORD');
+
+// Configure OAuth2 access token for authorization: OAuth2
+$config = Bandwidth\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
+
+
+$apiInstance = new Bandwidth\Api\ConferencesApi(
+ // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
+ // This is optional, `GuzzleHttp\Client` will be used as default.
+ new GuzzleHttp\Client(),
+ $config
+);
+$account_id = 9900000; // string | Your Bandwidth Account ID.
+$conference_id = conf-fe23a767-a75a5b77-20c5-4cca-b581-cbbf0776eca9; // string | Programmable Voice API Conference ID.
+
+$hostIndex = 0;
+$variables = [
+];
+
+try {
+ $result = $apiInstance->getConference($account_id, $conference_id, $hostIndex, $variables);
+ print_r($result);
+} catch (Exception $e) {
+ echo 'Exception when calling ConferencesApi->getConference: ', $e->getMessage(), PHP_EOL;
+}
+```
+
+### Parameters
+
+| Name | Type | Description | Notes |
+| ------------- | ------------- | ------------- | ------------- |
+| **account_id** | **string**| Your Bandwidth Account ID. | |
+| **conference_id** | **string**| Programmable Voice API Conference ID. | |
+| hostIndex | null|int | Host index. Defaults to null. If null, then the library will use $this->hostIndex instead | [optional] |
+| variables | array | Associative array of variables to pass to the host. Defaults to empty array. | [optional] |
+
+### Return type
+
+[**\Bandwidth\Model\Conference**](../Model/Conference.md)
+
+### Authorization
+
+[Basic](../../README.md#Basic), [OAuth2](../../README.md#OAuth2)
+
+### HTTP request headers
+
+- **Content-Type**: Not defined
+- **Accept**: `application/json`
+
+[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
+[[Back to Model list]](../../README.md#models)
+[[Back to README]](../../README.md)
+
+## `getConferenceMember()`
+
+```php
+getConferenceMember($account_id, $conference_id, $member_id): \Bandwidth\Model\ConferenceMember
+```
+### URI(s):
+- https://voice.bandwidth.com/api/v2 Production
+Get Conference Member
+
+Returns information about the specified conference member.
+
+### Example
+
+```php
+setUsername('YOUR_USERNAME')
+ ->setPassword('YOUR_PASSWORD');
+
+// Configure OAuth2 access token for authorization: OAuth2
+$config = Bandwidth\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
+
+
+$apiInstance = new Bandwidth\Api\ConferencesApi(
+ // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
+ // This is optional, `GuzzleHttp\Client` will be used as default.
+ new GuzzleHttp\Client(),
+ $config
+);
+$account_id = 9900000; // string | Your Bandwidth Account ID.
+$conference_id = conf-fe23a767-a75a5b77-20c5-4cca-b581-cbbf0776eca9; // string | Programmable Voice API Conference ID.
+$member_id = c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85; // string | Programmable Voice API Conference Member ID.
+
+$hostIndex = 0;
+$variables = [
+];
+
+try {
+ $result = $apiInstance->getConferenceMember($account_id, $conference_id, $member_id, $hostIndex, $variables);
+ print_r($result);
+} catch (Exception $e) {
+ echo 'Exception when calling ConferencesApi->getConferenceMember: ', $e->getMessage(), PHP_EOL;
+}
+```
+
+### Parameters
+
+| Name | Type | Description | Notes |
+| ------------- | ------------- | ------------- | ------------- |
+| **account_id** | **string**| Your Bandwidth Account ID. | |
+| **conference_id** | **string**| Programmable Voice API Conference ID. | |
+| **member_id** | **string**| Programmable Voice API Conference Member ID. | |
+| hostIndex | null|int | Host index. Defaults to null. If null, then the library will use $this->hostIndex instead | [optional] |
+| variables | array | Associative array of variables to pass to the host. Defaults to empty array. | [optional] |
+
+### Return type
+
+[**\Bandwidth\Model\ConferenceMember**](../Model/ConferenceMember.md)
+
+### Authorization
+
+[Basic](../../README.md#Basic), [OAuth2](../../README.md#OAuth2)
+
+### HTTP request headers
+
+- **Content-Type**: Not defined
+- **Accept**: `application/json`
+
+[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
+[[Back to Model list]](../../README.md#models)
+[[Back to README]](../../README.md)
+
+## `getConferenceRecording()`
+
+```php
+getConferenceRecording($account_id, $conference_id, $recording_id): \Bandwidth\Model\ConferenceRecordingMetadata
+```
+### URI(s):
+- https://voice.bandwidth.com/api/v2 Production
+Get Conference Recording Information
+
+Returns metadata for the specified recording.
+
+### Example
+
+```php
+setUsername('YOUR_USERNAME')
+ ->setPassword('YOUR_PASSWORD');
+
+// Configure OAuth2 access token for authorization: OAuth2
+$config = Bandwidth\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
+
+
+$apiInstance = new Bandwidth\Api\ConferencesApi(
+ // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
+ // This is optional, `GuzzleHttp\Client` will be used as default.
+ new GuzzleHttp\Client(),
+ $config
+);
+$account_id = 9900000; // string | Your Bandwidth Account ID.
+$conference_id = conf-fe23a767-a75a5b77-20c5-4cca-b581-cbbf0776eca9; // string | Programmable Voice API Conference ID.
+$recording_id = r-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85; // string | Programmable Voice API Recording ID.
+
+$hostIndex = 0;
+$variables = [
+];
+
+try {
+ $result = $apiInstance->getConferenceRecording($account_id, $conference_id, $recording_id, $hostIndex, $variables);
+ print_r($result);
+} catch (Exception $e) {
+ echo 'Exception when calling ConferencesApi->getConferenceRecording: ', $e->getMessage(), PHP_EOL;
+}
+```
+
+### Parameters
+
+| Name | Type | Description | Notes |
+| ------------- | ------------- | ------------- | ------------- |
+| **account_id** | **string**| Your Bandwidth Account ID. | |
+| **conference_id** | **string**| Programmable Voice API Conference ID. | |
+| **recording_id** | **string**| Programmable Voice API Recording ID. | |
+| hostIndex | null|int | Host index. Defaults to null. If null, then the library will use $this->hostIndex instead | [optional] |
+| variables | array | Associative array of variables to pass to the host. Defaults to empty array. | [optional] |
+
+### Return type
+
+[**\Bandwidth\Model\ConferenceRecordingMetadata**](../Model/ConferenceRecordingMetadata.md)
+
+### Authorization
+
+[Basic](../../README.md#Basic), [OAuth2](../../README.md#OAuth2)
+
+### HTTP request headers
+
+- **Content-Type**: Not defined
+- **Accept**: `application/json`
+
+[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
+[[Back to Model list]](../../README.md#models)
+[[Back to README]](../../README.md)
+
+## `listConferenceRecordings()`
+
+```php
+listConferenceRecordings($account_id, $conference_id): \Bandwidth\Model\ConferenceRecordingMetadata[]
+```
+### URI(s):
+- https://voice.bandwidth.com/api/v2 Production
+Get Conference Recordings
+
+Returns a (potentially empty) list of metadata for the recordings that took place during the specified conference.
+
+### Example
+
+```php
+setUsername('YOUR_USERNAME')
+ ->setPassword('YOUR_PASSWORD');
+
+// Configure OAuth2 access token for authorization: OAuth2
+$config = Bandwidth\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
+
+
+$apiInstance = new Bandwidth\Api\ConferencesApi(
+ // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
+ // This is optional, `GuzzleHttp\Client` will be used as default.
+ new GuzzleHttp\Client(),
+ $config
+);
+$account_id = 9900000; // string | Your Bandwidth Account ID.
+$conference_id = conf-fe23a767-a75a5b77-20c5-4cca-b581-cbbf0776eca9; // string | Programmable Voice API Conference ID.
+
+$hostIndex = 0;
+$variables = [
+];
+
+try {
+ $result = $apiInstance->listConferenceRecordings($account_id, $conference_id, $hostIndex, $variables);
+ print_r($result);
+} catch (Exception $e) {
+ echo 'Exception when calling ConferencesApi->listConferenceRecordings: ', $e->getMessage(), PHP_EOL;
+}
+```
+
+### Parameters
+
+| Name | Type | Description | Notes |
+| ------------- | ------------- | ------------- | ------------- |
+| **account_id** | **string**| Your Bandwidth Account ID. | |
+| **conference_id** | **string**| Programmable Voice API Conference ID. | |
+| hostIndex | null|int | Host index. Defaults to null. If null, then the library will use $this->hostIndex instead | [optional] |
+| variables | array | Associative array of variables to pass to the host. Defaults to empty array. | [optional] |
+
+### Return type
+
+[**\Bandwidth\Model\ConferenceRecordingMetadata[]**](../Model/ConferenceRecordingMetadata.md)
+
+### Authorization
+
+[Basic](../../README.md#Basic), [OAuth2](../../README.md#OAuth2)
+
+### HTTP request headers
+
+- **Content-Type**: Not defined
+- **Accept**: `application/json`
+
+[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
+[[Back to Model list]](../../README.md#models)
+[[Back to README]](../../README.md)
+
+## `listConferences()`
+
+```php
+listConferences($account_id, $name, $min_created_time, $max_created_time, $page_size, $page_token): \Bandwidth\Model\Conference[]
+```
+### URI(s):
+- https://voice.bandwidth.com/api/v2 Production
+Get Conferences
+
+Returns a max of 1000 conferences, sorted by `createdTime` from oldest to newest. **NOTE:** If the number of conferences in the account is bigger than `pageSize`, a `Link` header (with format `<{url}>; rel=\"next\"`) will be returned in the response. The url can be used to retrieve the next page of conference records.
+
+### Example
+
+```php
+setUsername('YOUR_USERNAME')
+ ->setPassword('YOUR_PASSWORD');
+
+// Configure OAuth2 access token for authorization: OAuth2
+$config = Bandwidth\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
+
+
+$apiInstance = new Bandwidth\Api\ConferencesApi(
+ // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
+ // This is optional, `GuzzleHttp\Client` will be used as default.
+ new GuzzleHttp\Client(),
+ $config
+);
+$account_id = 9900000; // string | Your Bandwidth Account ID.
+$name = my-custom-name; // string | Filter results by the `name` field.
+$min_created_time = 2022-06-21T19:13:21Z; // string | Filter results to conferences which have a `createdTime` after or at `minCreatedTime` (in ISO8601 format).
+$max_created_time = 2022-06-21T19:13:21Z; // string | Filter results to conferences which have a `createdTime` before or at `maxCreatedTime` (in ISO8601 format).
+$page_size = 500; // int | Specifies the max number of conferences that will be returned.
+$page_token = eyJwYWdlVG9rZW4iOiJ0b2tlbiJ9; // string | Not intended for explicit use. To use pagination, follow the links in the `Link` header of the response, as indicated in the endpoint description.
+
+$hostIndex = 0;
+$variables = [
+];
+
+try {
+ $result = $apiInstance->listConferences($account_id, $name, $min_created_time, $max_created_time, $page_size, $page_token, $hostIndex, $variables);
+ print_r($result);
+} catch (Exception $e) {
+ echo 'Exception when calling ConferencesApi->listConferences: ', $e->getMessage(), PHP_EOL;
+}
+```
+
+### Parameters
+
+| Name | Type | Description | Notes |
+| ------------- | ------------- | ------------- | ------------- |
+| **account_id** | **string**| Your Bandwidth Account ID. | |
+| **name** | **string**| Filter results by the `name` field. | [optional] |
+| **min_created_time** | **string**| Filter results to conferences which have a `createdTime` after or at `minCreatedTime` (in ISO8601 format). | [optional] |
+| **max_created_time** | **string**| Filter results to conferences which have a `createdTime` before or at `maxCreatedTime` (in ISO8601 format). | [optional] |
+| **page_size** | **int**| Specifies the max number of conferences that will be returned. | [optional] [default to 1000] |
+| **page_token** | **string**| Not intended for explicit use. To use pagination, follow the links in the `Link` header of the response, as indicated in the endpoint description. | [optional] |
+| hostIndex | null|int | Host index. Defaults to null. If null, then the library will use $this->hostIndex instead | [optional] |
+| variables | array | Associative array of variables to pass to the host. Defaults to empty array. | [optional] |
+
+### Return type
+
+[**\Bandwidth\Model\Conference[]**](../Model/Conference.md)
+
+### Authorization
+
+[Basic](../../README.md#Basic), [OAuth2](../../README.md#OAuth2)
+
+### HTTP request headers
+
+- **Content-Type**: Not defined
+- **Accept**: `application/json`
+
+[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
+[[Back to Model list]](../../README.md#models)
+[[Back to README]](../../README.md)
+
+## `updateConference()`
+
+```php
+updateConference($account_id, $conference_id, $update_conference)
+```
+### URI(s):
+- https://voice.bandwidth.com/api/v2 Production
+Update Conference
+
+Update the conference state.
+
+### Example
+
+```php
+setUsername('YOUR_USERNAME')
+ ->setPassword('YOUR_PASSWORD');
+
+// Configure OAuth2 access token for authorization: OAuth2
+$config = Bandwidth\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
+
+
+$apiInstance = new Bandwidth\Api\ConferencesApi(
+ // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
+ // This is optional, `GuzzleHttp\Client` will be used as default.
+ new GuzzleHttp\Client(),
+ $config
+);
+$account_id = 9900000; // string | Your Bandwidth Account ID.
+$conference_id = conf-fe23a767-a75a5b77-20c5-4cca-b581-cbbf0776eca9; // string | Programmable Voice API Conference ID.
+$update_conference = new \Bandwidth\Model\UpdateConference(); // \Bandwidth\Model\UpdateConference
+
+$hostIndex = 0;
+$variables = [
+];
+
+try {
+ $apiInstance->updateConference($account_id, $conference_id, $update_conference, $hostIndex, $variables);
+} catch (Exception $e) {
+ echo 'Exception when calling ConferencesApi->updateConference: ', $e->getMessage(), PHP_EOL;
+}
+```
+
+### Parameters
+
+| Name | Type | Description | Notes |
+| ------------- | ------------- | ------------- | ------------- |
+| **account_id** | **string**| Your Bandwidth Account ID. | |
+| **conference_id** | **string**| Programmable Voice API Conference ID. | |
+| **update_conference** | [**\Bandwidth\Model\UpdateConference**](../Model/UpdateConference.md)| | |
+| hostIndex | null|int | Host index. Defaults to null. If null, then the library will use $this->hostIndex instead | [optional] |
+| variables | array | Associative array of variables to pass to the host. Defaults to empty array. | [optional] |
+
+### Return type
+
+void (empty response body)
+
+### Authorization
+
+[Basic](../../README.md#Basic), [OAuth2](../../README.md#OAuth2)
+
+### HTTP request headers
+
+- **Content-Type**: `application/json`
+- **Accept**: `application/json`
+
+[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
+[[Back to Model list]](../../README.md#models)
+[[Back to README]](../../README.md)
+
+## `updateConferenceBxml()`
+
+```php
+updateConferenceBxml($account_id, $conference_id, $body)
+```
+### URI(s):
+- https://voice.bandwidth.com/api/v2 Production
+Update Conference BXML
+
+Update the conference BXML document.
+
+### Example
+
+```php
+setUsername('YOUR_USERNAME')
+ ->setPassword('YOUR_PASSWORD');
+
+// Configure OAuth2 access token for authorization: OAuth2
+$config = Bandwidth\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
+
+
+$apiInstance = new Bandwidth\Api\ConferencesApi(
+ // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
+ // This is optional, `GuzzleHttp\Client` will be used as default.
+ new GuzzleHttp\Client(),
+ $config
+);
+$account_id = 9900000; // string | Your Bandwidth Account ID.
+$conference_id = conf-fe23a767-a75a5b77-20c5-4cca-b581-cbbf0776eca9; // string | Programmable Voice API Conference ID.
+$body =
+
+
+ ; // string
+
+$hostIndex = 0;
+$variables = [
+];
+
+try {
+ $apiInstance->updateConferenceBxml($account_id, $conference_id, $body, $hostIndex, $variables);
+} catch (Exception $e) {
+ echo 'Exception when calling ConferencesApi->updateConferenceBxml: ', $e->getMessage(), PHP_EOL;
+}
+```
+
+### Parameters
+
+| Name | Type | Description | Notes |
+| ------------- | ------------- | ------------- | ------------- |
+| **account_id** | **string**| Your Bandwidth Account ID. | |
+| **conference_id** | **string**| Programmable Voice API Conference ID. | |
+| **body** | **string**| | |
+| hostIndex | null|int | Host index. Defaults to null. If null, then the library will use $this->hostIndex instead | [optional] |
+| variables | array | Associative array of variables to pass to the host. Defaults to empty array. | [optional] |
+
+### Return type
+
+void (empty response body)
+
+### Authorization
+
+[Basic](../../README.md#Basic), [OAuth2](../../README.md#OAuth2)
+
+### HTTP request headers
+
+- **Content-Type**: `application/xml`
+- **Accept**: `application/json`
+
+[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
+[[Back to Model list]](../../README.md#models)
+[[Back to README]](../../README.md)
+
+## `updateConferenceMember()`
+
+```php
+updateConferenceMember($account_id, $conference_id, $member_id, $update_conference_member)
+```
+### URI(s):
+- https://voice.bandwidth.com/api/v2 Production
+Update Conference Member
+
+Updates settings for a particular conference member.
+
+### Example
+
+```php
+setUsername('YOUR_USERNAME')
+ ->setPassword('YOUR_PASSWORD');
+
+// Configure OAuth2 access token for authorization: OAuth2
+$config = Bandwidth\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
+
+
+$apiInstance = new Bandwidth\Api\ConferencesApi(
+ // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
+ // This is optional, `GuzzleHttp\Client` will be used as default.
+ new GuzzleHttp\Client(),
+ $config
+);
+$account_id = 9900000; // string | Your Bandwidth Account ID.
+$conference_id = conf-fe23a767-a75a5b77-20c5-4cca-b581-cbbf0776eca9; // string | Programmable Voice API Conference ID.
+$member_id = c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85; // string | Programmable Voice API Conference Member ID.
+$update_conference_member = new \Bandwidth\Model\UpdateConferenceMember(); // \Bandwidth\Model\UpdateConferenceMember
+
+$hostIndex = 0;
+$variables = [
+];
+
+try {
+ $apiInstance->updateConferenceMember($account_id, $conference_id, $member_id, $update_conference_member, $hostIndex, $variables);
+} catch (Exception $e) {
+ echo 'Exception when calling ConferencesApi->updateConferenceMember: ', $e->getMessage(), PHP_EOL;
+}
+```
+
+### Parameters
+
+| Name | Type | Description | Notes |
+| ------------- | ------------- | ------------- | ------------- |
+| **account_id** | **string**| Your Bandwidth Account ID. | |
+| **conference_id** | **string**| Programmable Voice API Conference ID. | |
+| **member_id** | **string**| Programmable Voice API Conference Member ID. | |
+| **update_conference_member** | [**\Bandwidth\Model\UpdateConferenceMember**](../Model/UpdateConferenceMember.md)| | |
+| hostIndex | null|int | Host index. Defaults to null. If null, then the library will use $this->hostIndex instead | [optional] |
+| variables | array | Associative array of variables to pass to the host. Defaults to empty array. | [optional] |
+
+### Return type
+
+void (empty response body)
+
+### Authorization
+
+[Basic](../../README.md#Basic), [OAuth2](../../README.md#OAuth2)
+
+### HTTP request headers
+
+- **Content-Type**: `application/json`
+- **Accept**: `application/json`
+
+[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
+[[Back to Model list]](../../README.md#models)
+[[Back to README]](../../README.md)
diff --git a/docs/Api/EndpointsApi.md b/docs/Api/EndpointsApi.md
new file mode 100644
index 0000000..fe416f9
--- /dev/null
+++ b/docs/Api/EndpointsApi.md
@@ -0,0 +1,388 @@
+# Bandwidth\EndpointsApi
+
+All URIs are relative to http://localhost, except if the operation defines another base path.
+
+| Method | HTTP request | Description |
+| ------------- | ------------- | ------------- |
+| [**createEndpoint()**](EndpointsApi.md#createEndpoint) | **POST** /accounts/{accountId}/endpoints | Create Endpoint |
+| [**deleteEndpoint()**](EndpointsApi.md#deleteEndpoint) | **DELETE** /accounts/{accountId}/endpoints/{endpointId} | Delete Endpoint |
+| [**getEndpoint()**](EndpointsApi.md#getEndpoint) | **GET** /accounts/{accountId}/endpoints/{endpointId} | Get Endpoint |
+| [**listEndpoints()**](EndpointsApi.md#listEndpoints) | **GET** /accounts/{accountId}/endpoints | List Endpoints |
+| [**updateEndpointBxml()**](EndpointsApi.md#updateEndpointBxml) | **PUT** /accounts/{accountId}/endpoints/{endpointId}/bxml | Update Endpoint BXML |
+
+
+## `createEndpoint()`
+
+```php
+createEndpoint($account_id, $body): \Bandwidth\Model\CreateEndpointResponse
+```
+### URI(s):
+- https://api.bandwidth.com/v2 Production
+Create Endpoint
+
+Creates a new Endpoint for the specified account.
+
+### Example
+
+```php
+setUsername('YOUR_USERNAME')
+ ->setPassword('YOUR_PASSWORD');
+
+// Configure OAuth2 access token for authorization: OAuth2
+$config = Bandwidth\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
+
+
+$apiInstance = new Bandwidth\Api\EndpointsApi(
+ // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
+ // This is optional, `GuzzleHttp\Client` will be used as default.
+ new GuzzleHttp\Client(),
+ $config
+);
+$account_id = 9900000; // string | Your Bandwidth Account ID.
+$body = new \Bandwidth\Model\CreateWebRtcConnectionRequest(); // \Bandwidth\Model\CreateWebRtcConnectionRequest
+
+$hostIndex = 0;
+$variables = [
+];
+
+try {
+ $result = $apiInstance->createEndpoint($account_id, $body, $hostIndex, $variables);
+ print_r($result);
+} catch (Exception $e) {
+ echo 'Exception when calling EndpointsApi->createEndpoint: ', $e->getMessage(), PHP_EOL;
+}
+```
+
+### Parameters
+
+| Name | Type | Description | Notes |
+| ------------- | ------------- | ------------- | ------------- |
+| **account_id** | **string**| Your Bandwidth Account ID. | |
+| **body** | **\Bandwidth\Model\CreateWebRtcConnectionRequest**| | |
+| hostIndex | null|int | Host index. Defaults to null. If null, then the library will use $this->hostIndex instead | [optional] |
+| variables | array | Associative array of variables to pass to the host. Defaults to empty array. | [optional] |
+
+### Return type
+
+[**\Bandwidth\Model\CreateEndpointResponse**](../Model/CreateEndpointResponse.md)
+
+### Authorization
+
+[Basic](../../README.md#Basic), [OAuth2](../../README.md#OAuth2)
+
+### HTTP request headers
+
+- **Content-Type**: `application/json`
+- **Accept**: `application/json`
+
+[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
+[[Back to Model list]](../../README.md#models)
+[[Back to README]](../../README.md)
+
+## `deleteEndpoint()`
+
+```php
+deleteEndpoint($account_id, $endpoint_id)
+```
+### URI(s):
+- https://api.bandwidth.com/v2 Production
+Delete Endpoint
+
+Deletes the specified endpoint. If the endpoint is actively streaming media, the media stream will be terminated.
+
+### Example
+
+```php
+setUsername('YOUR_USERNAME')
+ ->setPassword('YOUR_PASSWORD');
+
+// Configure OAuth2 access token for authorization: OAuth2
+$config = Bandwidth\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
+
+
+$apiInstance = new Bandwidth\Api\EndpointsApi(
+ // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
+ // This is optional, `GuzzleHttp\Client` will be used as default.
+ new GuzzleHttp\Client(),
+ $config
+);
+$account_id = 9900000; // string | Your Bandwidth Account ID.
+$endpoint_id = e-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85; // string | BRTC Endpoint ID.
+
+$hostIndex = 0;
+$variables = [
+];
+
+try {
+ $apiInstance->deleteEndpoint($account_id, $endpoint_id, $hostIndex, $variables);
+} catch (Exception $e) {
+ echo 'Exception when calling EndpointsApi->deleteEndpoint: ', $e->getMessage(), PHP_EOL;
+}
+```
+
+### Parameters
+
+| Name | Type | Description | Notes |
+| ------------- | ------------- | ------------- | ------------- |
+| **account_id** | **string**| Your Bandwidth Account ID. | |
+| **endpoint_id** | **string**| BRTC Endpoint ID. | |
+| hostIndex | null|int | Host index. Defaults to null. If null, then the library will use $this->hostIndex instead | [optional] |
+| variables | array | Associative array of variables to pass to the host. Defaults to empty array. | [optional] |
+
+### Return type
+
+void (empty response body)
+
+### Authorization
+
+[Basic](../../README.md#Basic), [OAuth2](../../README.md#OAuth2)
+
+### HTTP request headers
+
+- **Content-Type**: Not defined
+- **Accept**: `application/json`
+
+[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
+[[Back to Model list]](../../README.md#models)
+[[Back to README]](../../README.md)
+
+## `getEndpoint()`
+
+```php
+getEndpoint($account_id, $endpoint_id): \Bandwidth\Model\EndpointResponse
+```
+### URI(s):
+- https://api.bandwidth.com/v2 Production
+Get Endpoint
+
+Returns information about the specified endpoint.
+
+### Example
+
+```php
+setUsername('YOUR_USERNAME')
+ ->setPassword('YOUR_PASSWORD');
+
+// Configure OAuth2 access token for authorization: OAuth2
+$config = Bandwidth\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
+
+
+$apiInstance = new Bandwidth\Api\EndpointsApi(
+ // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
+ // This is optional, `GuzzleHttp\Client` will be used as default.
+ new GuzzleHttp\Client(),
+ $config
+);
+$account_id = 9900000; // string | Your Bandwidth Account ID.
+$endpoint_id = e-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85; // string | BRTC Endpoint ID.
+
+$hostIndex = 0;
+$variables = [
+];
+
+try {
+ $result = $apiInstance->getEndpoint($account_id, $endpoint_id, $hostIndex, $variables);
+ print_r($result);
+} catch (Exception $e) {
+ echo 'Exception when calling EndpointsApi->getEndpoint: ', $e->getMessage(), PHP_EOL;
+}
+```
+
+### Parameters
+
+| Name | Type | Description | Notes |
+| ------------- | ------------- | ------------- | ------------- |
+| **account_id** | **string**| Your Bandwidth Account ID. | |
+| **endpoint_id** | **string**| BRTC Endpoint ID. | |
+| hostIndex | null|int | Host index. Defaults to null. If null, then the library will use $this->hostIndex instead | [optional] |
+| variables | array | Associative array of variables to pass to the host. Defaults to empty array. | [optional] |
+
+### Return type
+
+[**\Bandwidth\Model\EndpointResponse**](../Model/EndpointResponse.md)
+
+### Authorization
+
+[Basic](../../README.md#Basic), [OAuth2](../../README.md#OAuth2)
+
+### HTTP request headers
+
+- **Content-Type**: Not defined
+- **Accept**: `application/json`
+
+[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
+[[Back to Model list]](../../README.md#models)
+[[Back to README]](../../README.md)
+
+## `listEndpoints()`
+
+```php
+listEndpoints($account_id, $type, $status, $after_cursor, $limit): \Bandwidth\Model\ListEndpointsResponse
+```
+### URI(s):
+- https://api.bandwidth.com/v2 Production
+List Endpoints
+
+Returns a list of endpoints associated with the specified account.
+
+### Example
+
+```php
+setUsername('YOUR_USERNAME')
+ ->setPassword('YOUR_PASSWORD');
+
+// Configure OAuth2 access token for authorization: OAuth2
+$config = Bandwidth\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
+
+
+$apiInstance = new Bandwidth\Api\EndpointsApi(
+ // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
+ // This is optional, `GuzzleHttp\Client` will be used as default.
+ new GuzzleHttp\Client(),
+ $config
+);
+$account_id = 9900000; // string | Your Bandwidth Account ID.
+$type = new \Bandwidth\Model\\Bandwidth\Model\EndpointTypeEnum(); // \Bandwidth\Model\EndpointTypeEnum | The type of endpoint.
+$status = new \Bandwidth\Model\\Bandwidth\Model\EndpointStatusEnum(); // \Bandwidth\Model\EndpointStatusEnum | The status of the endpoint.
+$after_cursor = TWF5IHRoZSBmb3JjZSBiZSB3aXRoIHlvdQ==; // string | The cursor to use for pagination. This is the value of the `next` link in the previous response.
+$limit = 2; // int | The maximum number of endpoints to return in the response.
+
+$hostIndex = 0;
+$variables = [
+];
+
+try {
+ $result = $apiInstance->listEndpoints($account_id, $type, $status, $after_cursor, $limit, $hostIndex, $variables);
+ print_r($result);
+} catch (Exception $e) {
+ echo 'Exception when calling EndpointsApi->listEndpoints: ', $e->getMessage(), PHP_EOL;
+}
+```
+
+### Parameters
+
+| Name | Type | Description | Notes |
+| ------------- | ------------- | ------------- | ------------- |
+| **account_id** | **string**| Your Bandwidth Account ID. | |
+| **type** | [**\Bandwidth\Model\EndpointTypeEnum**](../Model/.md)| The type of endpoint. | [optional] |
+| **status** | [**\Bandwidth\Model\EndpointStatusEnum**](../Model/.md)| The status of the endpoint. | [optional] |
+| **after_cursor** | **string**| The cursor to use for pagination. This is the value of the `next` link in the previous response. | [optional] |
+| **limit** | **int**| The maximum number of endpoints to return in the response. | [optional] [default to 100] |
+| hostIndex | null|int | Host index. Defaults to null. If null, then the library will use $this->hostIndex instead | [optional] |
+| variables | array | Associative array of variables to pass to the host. Defaults to empty array. | [optional] |
+
+### Return type
+
+[**\Bandwidth\Model\ListEndpointsResponse**](../Model/ListEndpointsResponse.md)
+
+### Authorization
+
+[Basic](../../README.md#Basic), [OAuth2](../../README.md#OAuth2)
+
+### HTTP request headers
+
+- **Content-Type**: Not defined
+- **Accept**: `application/json`
+
+[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
+[[Back to Model list]](../../README.md#models)
+[[Back to README]](../../README.md)
+
+## `updateEndpointBxml()`
+
+```php
+updateEndpointBxml($account_id, $endpoint_id, $body)
+```
+### URI(s):
+- https://api.bandwidth.com/v2 Production
+Update Endpoint BXML
+
+Updates the BXML for the specified endpoint.
+
+### Example
+
+```php
+setUsername('YOUR_USERNAME')
+ ->setPassword('YOUR_PASSWORD');
+
+// Configure OAuth2 access token for authorization: OAuth2
+$config = Bandwidth\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
+
+
+$apiInstance = new Bandwidth\Api\EndpointsApi(
+ // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
+ // This is optional, `GuzzleHttp\Client` will be used as default.
+ new GuzzleHttp\Client(),
+ $config
+);
+$account_id = 9900000; // string | Your Bandwidth Account ID.
+$endpoint_id = e-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85; // string | BRTC Endpoint ID.
+$body = 'body_example'; // string
+
+$hostIndex = 0;
+$variables = [
+];
+
+try {
+ $apiInstance->updateEndpointBxml($account_id, $endpoint_id, $body, $hostIndex, $variables);
+} catch (Exception $e) {
+ echo 'Exception when calling EndpointsApi->updateEndpointBxml: ', $e->getMessage(), PHP_EOL;
+}
+```
+
+### Parameters
+
+| Name | Type | Description | Notes |
+| ------------- | ------------- | ------------- | ------------- |
+| **account_id** | **string**| Your Bandwidth Account ID. | |
+| **endpoint_id** | **string**| BRTC Endpoint ID. | |
+| **body** | **string**| | |
+| hostIndex | null|int | Host index. Defaults to null. If null, then the library will use $this->hostIndex instead | [optional] |
+| variables | array | Associative array of variables to pass to the host. Defaults to empty array. | [optional] |
+
+### Return type
+
+void (empty response body)
+
+### Authorization
+
+[Basic](../../README.md#Basic), [OAuth2](../../README.md#OAuth2)
+
+### HTTP request headers
+
+- **Content-Type**: `application/xml`
+- **Accept**: `application/json`
+
+[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
+[[Back to Model list]](../../README.md#models)
+[[Back to README]](../../README.md)
diff --git a/docs/Api/MFAApi.md b/docs/Api/MFAApi.md
new file mode 100644
index 0000000..1f4196c
--- /dev/null
+++ b/docs/Api/MFAApi.md
@@ -0,0 +1,232 @@
+# Bandwidth\MFAApi
+
+All URIs are relative to http://localhost, except if the operation defines another base path.
+
+| Method | HTTP request | Description |
+| ------------- | ------------- | ------------- |
+| [**generateMessagingCode()**](MFAApi.md#generateMessagingCode) | **POST** /accounts/{accountId}/code/messaging | Messaging Authentication Code |
+| [**generateVoiceCode()**](MFAApi.md#generateVoiceCode) | **POST** /accounts/{accountId}/code/voice | Voice Authentication Code |
+| [**verifyCode()**](MFAApi.md#verifyCode) | **POST** /accounts/{accountId}/code/verify | Verify Authentication Code |
+
+
+## `generateMessagingCode()`
+
+```php
+generateMessagingCode($account_id, $code_request): \Bandwidth\Model\MessagingCodeResponse
+```
+### URI(s):
+- https://mfa.bandwidth.com/api/v1 Production
+Messaging Authentication Code
+
+Send an MFA code via text message (SMS).
+
+### Example
+
+```php
+setUsername('YOUR_USERNAME')
+ ->setPassword('YOUR_PASSWORD');
+
+// Configure OAuth2 access token for authorization: OAuth2
+$config = Bandwidth\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
+
+
+$apiInstance = new Bandwidth\Api\MFAApi(
+ // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
+ // This is optional, `GuzzleHttp\Client` will be used as default.
+ new GuzzleHttp\Client(),
+ $config
+);
+$account_id = 9900000; // string | Your Bandwidth Account ID.
+$code_request = new \Bandwidth\Model\CodeRequest(); // \Bandwidth\Model\CodeRequest | MFA code request body.
+
+$hostIndex = 0;
+$variables = [
+];
+
+try {
+ $result = $apiInstance->generateMessagingCode($account_id, $code_request, $hostIndex, $variables);
+ print_r($result);
+} catch (Exception $e) {
+ echo 'Exception when calling MFAApi->generateMessagingCode: ', $e->getMessage(), PHP_EOL;
+}
+```
+
+### Parameters
+
+| Name | Type | Description | Notes |
+| ------------- | ------------- | ------------- | ------------- |
+| **account_id** | **string**| Your Bandwidth Account ID. | |
+| **code_request** | [**\Bandwidth\Model\CodeRequest**](../Model/CodeRequest.md)| MFA code request body. | |
+| hostIndex | null|int | Host index. Defaults to null. If null, then the library will use $this->hostIndex instead | [optional] |
+| variables | array | Associative array of variables to pass to the host. Defaults to empty array. | [optional] |
+
+### Return type
+
+[**\Bandwidth\Model\MessagingCodeResponse**](../Model/MessagingCodeResponse.md)
+
+### Authorization
+
+[Basic](../../README.md#Basic), [OAuth2](../../README.md#OAuth2)
+
+### HTTP request headers
+
+- **Content-Type**: `application/json`
+- **Accept**: `application/json`
+
+[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
+[[Back to Model list]](../../README.md#models)
+[[Back to README]](../../README.md)
+
+## `generateVoiceCode()`
+
+```php
+generateVoiceCode($account_id, $code_request): \Bandwidth\Model\VoiceCodeResponse
+```
+### URI(s):
+- https://mfa.bandwidth.com/api/v1 Production
+Voice Authentication Code
+
+Send an MFA Code via a phone call.
+
+### Example
+
+```php
+setUsername('YOUR_USERNAME')
+ ->setPassword('YOUR_PASSWORD');
+
+// Configure OAuth2 access token for authorization: OAuth2
+$config = Bandwidth\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
+
+
+$apiInstance = new Bandwidth\Api\MFAApi(
+ // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
+ // This is optional, `GuzzleHttp\Client` will be used as default.
+ new GuzzleHttp\Client(),
+ $config
+);
+$account_id = 9900000; // string | Your Bandwidth Account ID.
+$code_request = new \Bandwidth\Model\CodeRequest(); // \Bandwidth\Model\CodeRequest | MFA code request body.
+
+$hostIndex = 0;
+$variables = [
+];
+
+try {
+ $result = $apiInstance->generateVoiceCode($account_id, $code_request, $hostIndex, $variables);
+ print_r($result);
+} catch (Exception $e) {
+ echo 'Exception when calling MFAApi->generateVoiceCode: ', $e->getMessage(), PHP_EOL;
+}
+```
+
+### Parameters
+
+| Name | Type | Description | Notes |
+| ------------- | ------------- | ------------- | ------------- |
+| **account_id** | **string**| Your Bandwidth Account ID. | |
+| **code_request** | [**\Bandwidth\Model\CodeRequest**](../Model/CodeRequest.md)| MFA code request body. | |
+| hostIndex | null|int | Host index. Defaults to null. If null, then the library will use $this->hostIndex instead | [optional] |
+| variables | array | Associative array of variables to pass to the host. Defaults to empty array. | [optional] |
+
+### Return type
+
+[**\Bandwidth\Model\VoiceCodeResponse**](../Model/VoiceCodeResponse.md)
+
+### Authorization
+
+[Basic](../../README.md#Basic), [OAuth2](../../README.md#OAuth2)
+
+### HTTP request headers
+
+- **Content-Type**: `application/json`
+- **Accept**: `application/json`
+
+[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
+[[Back to Model list]](../../README.md#models)
+[[Back to README]](../../README.md)
+
+## `verifyCode()`
+
+```php
+verifyCode($account_id, $verify_code_request): \Bandwidth\Model\VerifyCodeResponse
+```
+### URI(s):
+- https://mfa.bandwidth.com/api/v1 Production
+Verify Authentication Code
+
+Verify a previously sent MFA code.
+
+### Example
+
+```php
+setUsername('YOUR_USERNAME')
+ ->setPassword('YOUR_PASSWORD');
+
+// Configure OAuth2 access token for authorization: OAuth2
+$config = Bandwidth\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
+
+
+$apiInstance = new Bandwidth\Api\MFAApi(
+ // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
+ // This is optional, `GuzzleHttp\Client` will be used as default.
+ new GuzzleHttp\Client(),
+ $config
+);
+$account_id = 9900000; // string | Your Bandwidth Account ID.
+$verify_code_request = new \Bandwidth\Model\VerifyCodeRequest(); // \Bandwidth\Model\VerifyCodeRequest | MFA code verify request body.
+
+$hostIndex = 0;
+$variables = [
+];
+
+try {
+ $result = $apiInstance->verifyCode($account_id, $verify_code_request, $hostIndex, $variables);
+ print_r($result);
+} catch (Exception $e) {
+ echo 'Exception when calling MFAApi->verifyCode: ', $e->getMessage(), PHP_EOL;
+}
+```
+
+### Parameters
+
+| Name | Type | Description | Notes |
+| ------------- | ------------- | ------------- | ------------- |
+| **account_id** | **string**| Your Bandwidth Account ID. | |
+| **verify_code_request** | [**\Bandwidth\Model\VerifyCodeRequest**](../Model/VerifyCodeRequest.md)| MFA code verify request body. | |
+| hostIndex | null|int | Host index. Defaults to null. If null, then the library will use $this->hostIndex instead | [optional] |
+| variables | array | Associative array of variables to pass to the host. Defaults to empty array. | [optional] |
+
+### Return type
+
+[**\Bandwidth\Model\VerifyCodeResponse**](../Model/VerifyCodeResponse.md)
+
+### Authorization
+
+[Basic](../../README.md#Basic), [OAuth2](../../README.md#OAuth2)
+
+### HTTP request headers
+
+- **Content-Type**: `application/json`
+- **Accept**: `application/json`
+
+[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
+[[Back to Model list]](../../README.md#models)
+[[Back to README]](../../README.md)
diff --git a/docs/Api/MediaApi.md b/docs/Api/MediaApi.md
new file mode 100644
index 0000000..55d92a6
--- /dev/null
+++ b/docs/Api/MediaApi.md
@@ -0,0 +1,311 @@
+# Bandwidth\MediaApi
+
+All URIs are relative to http://localhost, except if the operation defines another base path.
+
+| Method | HTTP request | Description |
+| ------------- | ------------- | ------------- |
+| [**deleteMedia()**](MediaApi.md#deleteMedia) | **DELETE** /users/{accountId}/media/{mediaId} | Delete Media |
+| [**getMedia()**](MediaApi.md#getMedia) | **GET** /users/{accountId}/media/{mediaId} | Get Media |
+| [**listMedia()**](MediaApi.md#listMedia) | **GET** /users/{accountId}/media | List Media |
+| [**uploadMedia()**](MediaApi.md#uploadMedia) | **PUT** /users/{accountId}/media/{mediaId} | Upload Media |
+
+
+## `deleteMedia()`
+
+```php
+deleteMedia($account_id, $media_id)
+```
+### URI(s):
+- https://messaging.bandwidth.com/api/v2 Production
+Delete Media
+
+Deletes a media file from Bandwidth API server. Make sure you don't have any application scripts still using the media before you delete. If you accidentally delete a media file you can immediately upload a new file with the same name.
+
+### Example
+
+```php
+setUsername('YOUR_USERNAME')
+ ->setPassword('YOUR_PASSWORD');
+
+// Configure OAuth2 access token for authorization: OAuth2
+$config = Bandwidth\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
+
+
+$apiInstance = new Bandwidth\Api\MediaApi(
+ // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
+ // This is optional, `GuzzleHttp\Client` will be used as default.
+ new GuzzleHttp\Client(),
+ $config
+);
+$account_id = 9900000; // string | Your Bandwidth Account ID.
+$media_id = 14762070468292kw2fuqty55yp2b2/0/bw.png; // string | Media ID to retrieve.
+
+$hostIndex = 0;
+$variables = [
+];
+
+try {
+ $apiInstance->deleteMedia($account_id, $media_id, $hostIndex, $variables);
+} catch (Exception $e) {
+ echo 'Exception when calling MediaApi->deleteMedia: ', $e->getMessage(), PHP_EOL;
+}
+```
+
+### Parameters
+
+| Name | Type | Description | Notes |
+| ------------- | ------------- | ------------- | ------------- |
+| **account_id** | **string**| Your Bandwidth Account ID. | |
+| **media_id** | **string**| Media ID to retrieve. | |
+| hostIndex | null|int | Host index. Defaults to null. If null, then the library will use $this->hostIndex instead | [optional] |
+| variables | array | Associative array of variables to pass to the host. Defaults to empty array. | [optional] |
+
+### Return type
+
+void (empty response body)
+
+### Authorization
+
+[Basic](../../README.md#Basic), [OAuth2](../../README.md#OAuth2)
+
+### HTTP request headers
+
+- **Content-Type**: Not defined
+- **Accept**: `application/json`
+
+[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
+[[Back to Model list]](../../README.md#models)
+[[Back to README]](../../README.md)
+
+## `getMedia()`
+
+```php
+getMedia($account_id, $media_id): \SplFileObject
+```
+### URI(s):
+- https://messaging.bandwidth.com/api/v2 Production
+Get Media
+
+Downloads a media file you previously uploaded.
+
+### Example
+
+```php
+setUsername('YOUR_USERNAME')
+ ->setPassword('YOUR_PASSWORD');
+
+// Configure OAuth2 access token for authorization: OAuth2
+$config = Bandwidth\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
+
+
+$apiInstance = new Bandwidth\Api\MediaApi(
+ // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
+ // This is optional, `GuzzleHttp\Client` will be used as default.
+ new GuzzleHttp\Client(),
+ $config
+);
+$account_id = 9900000; // string | Your Bandwidth Account ID.
+$media_id = 14762070468292kw2fuqty55yp2b2/0/bw.png; // string | Media ID to retrieve.
+
+$hostIndex = 0;
+$variables = [
+];
+
+try {
+ $result = $apiInstance->getMedia($account_id, $media_id, $hostIndex, $variables);
+ print_r($result);
+} catch (Exception $e) {
+ echo 'Exception when calling MediaApi->getMedia: ', $e->getMessage(), PHP_EOL;
+}
+```
+
+### Parameters
+
+| Name | Type | Description | Notes |
+| ------------- | ------------- | ------------- | ------------- |
+| **account_id** | **string**| Your Bandwidth Account ID. | |
+| **media_id** | **string**| Media ID to retrieve. | |
+| hostIndex | null|int | Host index. Defaults to null. If null, then the library will use $this->hostIndex instead | [optional] |
+| variables | array | Associative array of variables to pass to the host. Defaults to empty array. | [optional] |
+
+### Return type
+
+**\SplFileObject**
+
+### Authorization
+
+[Basic](../../README.md#Basic), [OAuth2](../../README.md#OAuth2)
+
+### HTTP request headers
+
+- **Content-Type**: Not defined
+- **Accept**: `application/octet-stream`, `application/json`
+
+[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
+[[Back to Model list]](../../README.md#models)
+[[Back to README]](../../README.md)
+
+## `listMedia()`
+
+```php
+listMedia($account_id, $continuation_token): \Bandwidth\Model\Media[]
+```
+### URI(s):
+- https://messaging.bandwidth.com/api/v2 Production
+List Media
+
+Gets a list of your media files. No query parameters are supported.
+
+### Example
+
+```php
+setUsername('YOUR_USERNAME')
+ ->setPassword('YOUR_PASSWORD');
+
+// Configure OAuth2 access token for authorization: OAuth2
+$config = Bandwidth\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
+
+
+$apiInstance = new Bandwidth\Api\MediaApi(
+ // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
+ // This is optional, `GuzzleHttp\Client` will be used as default.
+ new GuzzleHttp\Client(),
+ $config
+);
+$account_id = 9900000; // string | Your Bandwidth Account ID.
+$continuation_token = 1XEi2tsFtLo1JbtLwETnM1ZJ+PqAa8w6ENvC5QKvwyrCDYII663Gy5M4s40owR1tjkuWUif6qbWvFtQJR5/ipqbUnfAqL254LKNlPy6tATCzioKSuHuOqgzloDkSwRtX0LtcL2otHS69hK343m+SjdL+vlj71tT39; // string | Continuation token used to retrieve subsequent media.
+
+$hostIndex = 0;
+$variables = [
+];
+
+try {
+ $result = $apiInstance->listMedia($account_id, $continuation_token, $hostIndex, $variables);
+ print_r($result);
+} catch (Exception $e) {
+ echo 'Exception when calling MediaApi->listMedia: ', $e->getMessage(), PHP_EOL;
+}
+```
+
+### Parameters
+
+| Name | Type | Description | Notes |
+| ------------- | ------------- | ------------- | ------------- |
+| **account_id** | **string**| Your Bandwidth Account ID. | |
+| **continuation_token** | **string**| Continuation token used to retrieve subsequent media. | [optional] |
+| hostIndex | null|int | Host index. Defaults to null. If null, then the library will use $this->hostIndex instead | [optional] |
+| variables | array | Associative array of variables to pass to the host. Defaults to empty array. | [optional] |
+
+### Return type
+
+[**\Bandwidth\Model\Media[]**](../Model/Media.md)
+
+### Authorization
+
+[Basic](../../README.md#Basic), [OAuth2](../../README.md#OAuth2)
+
+### HTTP request headers
+
+- **Content-Type**: Not defined
+- **Accept**: `application/json`
+
+[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
+[[Back to Model list]](../../README.md#models)
+[[Back to README]](../../README.md)
+
+## `uploadMedia()`
+
+```php
+uploadMedia($account_id, $media_id, $body, $content_type, $cache_control)
+```
+### URI(s):
+- https://messaging.bandwidth.com/api/v2 Production
+Upload Media
+
+Upload a file. You may add headers to the request in order to provide some control to your media file. If a file is uploaded with the same name as a file that already exists under this account, the previous file will be overwritten. A list of supported media types can be found at [Bandwidth Support](https://www.bandwidth.com/support/en/articles/12823220-what-mms-file-types-are-supported).
+
+### Example
+
+```php
+setUsername('YOUR_USERNAME')
+ ->setPassword('YOUR_PASSWORD');
+
+// Configure OAuth2 access token for authorization: OAuth2
+$config = Bandwidth\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
+
+
+$apiInstance = new Bandwidth\Api\MediaApi(
+ // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
+ // This is optional, `GuzzleHttp\Client` will be used as default.
+ new GuzzleHttp\Client(),
+ $config
+);
+$account_id = 9900000; // string | Your Bandwidth Account ID.
+$media_id = 14762070468292kw2fuqty55yp2b2/0/bw.png; // string | Media ID to retrieve.
+$body = '/path/to/file.txt'; // \SplFileObject
+$content_type = audio/wav; // string | The media type of the entity-body.
+$cache_control = no-cache; // string | General-header field is used to specify directives that MUST be obeyed by all caching mechanisms along the request/response chain.
+
+$hostIndex = 0;
+$variables = [
+];
+
+try {
+ $apiInstance->uploadMedia($account_id, $media_id, $body, $content_type, $cache_control, $hostIndex, $variables);
+} catch (Exception $e) {
+ echo 'Exception when calling MediaApi->uploadMedia: ', $e->getMessage(), PHP_EOL;
+}
+```
+
+### Parameters
+
+| Name | Type | Description | Notes |
+| ------------- | ------------- | ------------- | ------------- |
+| **account_id** | **string**| Your Bandwidth Account ID. | |
+| **media_id** | **string**| Media ID to retrieve. | |
+| **body** | **\SplFileObject****\SplFileObject**| | |
+| **content_type** | **string**| The media type of the entity-body. | [optional] |
+| **cache_control** | **string**| General-header field is used to specify directives that MUST be obeyed by all caching mechanisms along the request/response chain. | [optional] |
+| hostIndex | null|int | Host index. Defaults to null. If null, then the library will use $this->hostIndex instead | [optional] |
+| variables | array | Associative array of variables to pass to the host. Defaults to empty array. | [optional] |
+
+### Return type
+
+void (empty response body)
+
+### Authorization
+
+[Basic](../../README.md#Basic), [OAuth2](../../README.md#OAuth2)
+
+### 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/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`
+
+[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
+[[Back to Model list]](../../README.md#models)
+[[Back to README]](../../README.md)
diff --git a/docs/Api/MessagesApi.md b/docs/Api/MessagesApi.md
new file mode 100644
index 0000000..6638e37
--- /dev/null
+++ b/docs/Api/MessagesApi.md
@@ -0,0 +1,209 @@
+# Bandwidth\MessagesApi
+
+All URIs are relative to http://localhost, except if the operation defines another base path.
+
+| Method | HTTP request | Description |
+| ------------- | ------------- | ------------- |
+| [**createMessage()**](MessagesApi.md#createMessage) | **POST** /users/{accountId}/messages | Create Message |
+| [**listMessages()**](MessagesApi.md#listMessages) | **GET** /users/{accountId}/messages | List Messages |
+
+
+## `createMessage()`
+
+```php
+createMessage($account_id, $message_request): \Bandwidth\Model\Message
+```
+### URI(s):
+- https://messaging.bandwidth.com/api/v2 Production
+Create Message
+
+Endpoint for sending text messages and picture messages using V2 messaging.
+
+### Example
+
+```php
+setUsername('YOUR_USERNAME')
+ ->setPassword('YOUR_PASSWORD');
+
+// Configure OAuth2 access token for authorization: OAuth2
+$config = Bandwidth\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
+
+
+$apiInstance = new Bandwidth\Api\MessagesApi(
+ // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
+ // This is optional, `GuzzleHttp\Client` will be used as default.
+ new GuzzleHttp\Client(),
+ $config
+);
+$account_id = 9900000; // string | Your Bandwidth Account ID.
+$message_request = new \Bandwidth\Model\MessageRequest(); // \Bandwidth\Model\MessageRequest
+
+$hostIndex = 0;
+$variables = [
+];
+
+try {
+ $result = $apiInstance->createMessage($account_id, $message_request, $hostIndex, $variables);
+ print_r($result);
+} catch (Exception $e) {
+ echo 'Exception when calling MessagesApi->createMessage: ', $e->getMessage(), PHP_EOL;
+}
+```
+
+### Parameters
+
+| Name | Type | Description | Notes |
+| ------------- | ------------- | ------------- | ------------- |
+| **account_id** | **string**| Your Bandwidth Account ID. | |
+| **message_request** | [**\Bandwidth\Model\MessageRequest**](../Model/MessageRequest.md)| | |
+| hostIndex | null|int | Host index. Defaults to null. If null, then the library will use $this->hostIndex instead | [optional] |
+| variables | array | Associative array of variables to pass to the host. Defaults to empty array. | [optional] |
+
+### Return type
+
+[**\Bandwidth\Model\Message**](../Model/Message.md)
+
+### Authorization
+
+[Basic](../../README.md#Basic), [OAuth2](../../README.md#OAuth2)
+
+### HTTP request headers
+
+- **Content-Type**: `application/json`
+- **Accept**: `application/json`
+
+[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
+[[Back to Model list]](../../README.md#models)
+[[Back to README]](../../README.md)
+
+## `listMessages()`
+
+```php
+listMessages($account_id, $message_id, $source_tn, $destination_tn, $message_status, $message_direction, $carrier_name, $message_type, $error_code, $from_date_time, $to_date_time, $campaign_id, $from_bw_latency, $bw_queued, $product, $location, $carrier_queued, $from_carrier_latency, $calling_number_country_a3, $called_number_country_a3, $from_segment_count, $to_segment_count, $from_message_size, $to_message_size, $sort, $page_token, $limit, $limit_total_count): \Bandwidth\Model\MessagesList
+```
+### URI(s):
+- https://messaging.bandwidth.com/api/v2 Production
+List Messages
+
+Returns a list of messages based on query parameters. **Rate Limit:** This endpoint is rate limited to 3500 requests per 5 minutes per Source IP address. Exceeding the limit returns HTTP 429 with a `Retry-After` header.
+
+### Example
+
+```php
+setUsername('YOUR_USERNAME')
+ ->setPassword('YOUR_PASSWORD');
+
+// Configure OAuth2 access token for authorization: OAuth2
+$config = Bandwidth\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
+
+
+$apiInstance = new Bandwidth\Api\MessagesApi(
+ // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
+ // This is optional, `GuzzleHttp\Client` will be used as default.
+ new GuzzleHttp\Client(),
+ $config
+);
+$account_id = 9900000; // string | Your Bandwidth Account ID.
+$message_id = 9e0df4ca-b18d-40d7-a59f-82fcdf5ae8e6; // string | The ID of the message to search for. Special characters need to be encoded using URL encoding. Message IDs could come in different formats, e.g., 9e0df4ca-b18d-40d7-a59f-82fcdf5ae8e6 and 1589228074636lm4k2je7j7jklbn2 are valid message ID formats. Note that you must include at least one query parameter.
+$source_tn = %2B15554443333; // string | The phone number that sent the message. Accepted values are: a single full phone number a comma separated list of full phone numbers (maximum of 10) or a single partial phone number (minimum of 5 characters e.g. '%2B1919').
+$destination_tn = %2B15554443333; // string | The phone number that received the message. Accepted values are: a single full phone number a comma separated list of full phone numbers (maximum of 10) or a single partial phone number (minimum of 5 characters e.g. '%2B1919').
+$message_status = new \Bandwidth\Model\\Bandwidth\Model\MessageStatusEnum(); // \Bandwidth\Model\MessageStatusEnum | The status of the message. One of RECEIVED QUEUED SENDING SENT FAILED DELIVERED ACCEPTED UNDELIVERED.
+$message_direction = new \Bandwidth\Model\\Bandwidth\Model\ListMessageDirectionEnum(); // \Bandwidth\Model\ListMessageDirectionEnum | The direction of the message. One of INBOUND OUTBOUND.
+$carrier_name = Verizon; // string | The name of the carrier used for this message. Possible values include but are not limited to Verizon and TMobile. Special characters need to be encoded using URL encoding (i.e. AT&T should be passed as AT%26T).
+$message_type = new \Bandwidth\Model\\Bandwidth\Model\MessageTypeEnum(); // \Bandwidth\Model\MessageTypeEnum | The type of message. Either sms or mms.
+$error_code = 9902; // int | The error code of the message.
+$from_date_time = 2022-09-14T18:20:16.000Z; // string | The start of the date range to search in ISO 8601 format. Uses the message receive time. The date range to search in is currently 14 days.
+$to_date_time = 2022-09-14T18:20:16.000Z; // string | The end of the date range to search in ISO 8601 format. Uses the message receive time. The date range to search in is currently 14 days.
+$campaign_id = CJEUMDK; // string | The campaign ID of the message.
+$from_bw_latency = 5; // int | The minimum Bandwidth latency of the message in seconds. Only available for accounts with the Advanced Quality Metrics feature enabled.
+$bw_queued = true; // bool | A boolean value indicating whether the message is queued in the Bandwidth network.
+$product = P2P; // \Bandwidth\Model\ProductTypeEnum | Messaging product associated with the message.
+$location = 123ABC; // string | Location Id associated with the message.
+$carrier_queued = true; // bool | A boolean value indicating whether the message is queued in the carrier network. Only available for OUTBOUND messages from accounts with the Advanced Quality Metrics feature enabled.
+$from_carrier_latency = 50; // int | The minimum carrier latency of the message in seconds. Only available for OUTBOUND messages from accounts with the Advanced Quality Metrics feature enabled.
+$calling_number_country_a3 = USA; // string | Calling number country in A3 format.
+$called_number_country_a3 = USA; // string | Called number country in A3 format.
+$from_segment_count = 1; // int | Segment count (start range).
+$to_segment_count = 3; // int | Segment count (end range).
+$from_message_size = 100; // int | Message size (start range).
+$to_message_size = 120; // int | Message size (end range).
+$sort = sourceTn:desc; // string | The field and direction to sort by combined with a colon. Direction is either asc or desc.
+$page_token = gdEewhcJLQRB5; // string | A base64 encoded value used for pagination of results.
+$limit = 50; // int | The maximum records requested in search result. Default 100. The sum of limit and after cannot be more than 10000.
+$limit_total_count = true; // bool | When set to true, the response's totalCount field will have a maximum value of 10,000. When set to false, or excluded, this will give an accurate totalCount of all messages that match the provided filters. If you are experiencing latency, try using this parameter to limit your results.
+
+$hostIndex = 0;
+$variables = [
+];
+
+try {
+ $result = $apiInstance->listMessages($account_id, $message_id, $source_tn, $destination_tn, $message_status, $message_direction, $carrier_name, $message_type, $error_code, $from_date_time, $to_date_time, $campaign_id, $from_bw_latency, $bw_queued, $product, $location, $carrier_queued, $from_carrier_latency, $calling_number_country_a3, $called_number_country_a3, $from_segment_count, $to_segment_count, $from_message_size, $to_message_size, $sort, $page_token, $limit, $limit_total_count, $hostIndex, $variables);
+ print_r($result);
+} catch (Exception $e) {
+ echo 'Exception when calling MessagesApi->listMessages: ', $e->getMessage(), PHP_EOL;
+}
+```
+
+### Parameters
+
+| Name | Type | Description | Notes |
+| ------------- | ------------- | ------------- | ------------- |
+| **account_id** | **string**| Your Bandwidth Account ID. | |
+| **message_id** | **string**| The ID of the message to search for. Special characters need to be encoded using URL encoding. Message IDs could come in different formats, e.g., 9e0df4ca-b18d-40d7-a59f-82fcdf5ae8e6 and 1589228074636lm4k2je7j7jklbn2 are valid message ID formats. Note that you must include at least one query parameter. | [optional] |
+| **source_tn** | **string**| The phone number that sent the message. Accepted values are: a single full phone number a comma separated list of full phone numbers (maximum of 10) or a single partial phone number (minimum of 5 characters e.g. '%2B1919'). | [optional] |
+| **destination_tn** | **string**| The phone number that received the message. Accepted values are: a single full phone number a comma separated list of full phone numbers (maximum of 10) or a single partial phone number (minimum of 5 characters e.g. '%2B1919'). | [optional] |
+| **message_status** | [**\Bandwidth\Model\MessageStatusEnum**](../Model/.md)| The status of the message. One of RECEIVED QUEUED SENDING SENT FAILED DELIVERED ACCEPTED UNDELIVERED. | [optional] |
+| **message_direction** | [**\Bandwidth\Model\ListMessageDirectionEnum**](../Model/.md)| The direction of the message. One of INBOUND OUTBOUND. | [optional] |
+| **carrier_name** | **string**| The name of the carrier used for this message. Possible values include but are not limited to Verizon and TMobile. Special characters need to be encoded using URL encoding (i.e. AT&T should be passed as AT%26T). | [optional] |
+| **message_type** | [**\Bandwidth\Model\MessageTypeEnum**](../Model/.md)| The type of message. Either sms or mms. | [optional] |
+| **error_code** | **int**| The error code of the message. | [optional] |
+| **from_date_time** | **string**| The start of the date range to search in ISO 8601 format. Uses the message receive time. The date range to search in is currently 14 days. | [optional] |
+| **to_date_time** | **string**| The end of the date range to search in ISO 8601 format. Uses the message receive time. The date range to search in is currently 14 days. | [optional] |
+| **campaign_id** | **string**| The campaign ID of the message. | [optional] |
+| **from_bw_latency** | **int**| The minimum Bandwidth latency of the message in seconds. Only available for accounts with the Advanced Quality Metrics feature enabled. | [optional] |
+| **bw_queued** | **bool**| A boolean value indicating whether the message is queued in the Bandwidth network. | [optional] |
+| **product** | [**\Bandwidth\Model\ProductTypeEnum**](../Model/.md)| Messaging product associated with the message. | [optional] |
+| **location** | **string**| Location Id associated with the message. | [optional] |
+| **carrier_queued** | **bool**| A boolean value indicating whether the message is queued in the carrier network. Only available for OUTBOUND messages from accounts with the Advanced Quality Metrics feature enabled. | [optional] |
+| **from_carrier_latency** | **int**| The minimum carrier latency of the message in seconds. Only available for OUTBOUND messages from accounts with the Advanced Quality Metrics feature enabled. | [optional] |
+| **calling_number_country_a3** | **string**| Calling number country in A3 format. | [optional] |
+| **called_number_country_a3** | **string**| Called number country in A3 format. | [optional] |
+| **from_segment_count** | **int**| Segment count (start range). | [optional] |
+| **to_segment_count** | **int**| Segment count (end range). | [optional] |
+| **from_message_size** | **int**| Message size (start range). | [optional] |
+| **to_message_size** | **int**| Message size (end range). | [optional] |
+| **sort** | **string**| The field and direction to sort by combined with a colon. Direction is either asc or desc. | [optional] |
+| **page_token** | **string**| A base64 encoded value used for pagination of results. | [optional] |
+| **limit** | **int**| The maximum records requested in search result. Default 100. The sum of limit and after cannot be more than 10000. | [optional] |
+| **limit_total_count** | **bool**| When set to true, the response's totalCount field will have a maximum value of 10,000. When set to false, or excluded, this will give an accurate totalCount of all messages that match the provided filters. If you are experiencing latency, try using this parameter to limit your results. | [optional] |
+| hostIndex | null|int | Host index. Defaults to null. If null, then the library will use $this->hostIndex instead | [optional] |
+| variables | array | Associative array of variables to pass to the host. Defaults to empty array. | [optional] |
+
+### Return type
+
+[**\Bandwidth\Model\MessagesList**](../Model/MessagesList.md)
+
+### Authorization
+
+[Basic](../../README.md#Basic), [OAuth2](../../README.md#OAuth2)
+
+### HTTP request headers
+
+- **Content-Type**: Not defined
+- **Accept**: `application/json`
+
+[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
+[[Back to Model list]](../../README.md#models)
+[[Back to README]](../../README.md)
diff --git a/docs/Api/MultiChannelApi.md b/docs/Api/MultiChannelApi.md
new file mode 100644
index 0000000..bfeebb5
--- /dev/null
+++ b/docs/Api/MultiChannelApi.md
@@ -0,0 +1,82 @@
+# Bandwidth\MultiChannelApi
+
+All URIs are relative to http://localhost, except if the operation defines another base path.
+
+| Method | HTTP request | Description |
+| ------------- | ------------- | ------------- |
+| [**createMultiChannelMessage()**](MultiChannelApi.md#createMultiChannelMessage) | **POST** /users/{accountId}/messages/multiChannel | Create Multi-Channel Message |
+
+
+## `createMultiChannelMessage()`
+
+```php
+createMultiChannelMessage($account_id, $multi_channel_message_request): \Bandwidth\Model\CreateMultiChannelMessageResponse
+```
+### URI(s):
+- https://messaging.bandwidth.com/api/v2 Production
+Create Multi-Channel Message
+
+Endpoint for sending Multi-Channel messages.
+
+### Example
+
+```php
+setUsername('YOUR_USERNAME')
+ ->setPassword('YOUR_PASSWORD');
+
+// Configure OAuth2 access token for authorization: OAuth2
+$config = Bandwidth\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
+
+
+$apiInstance = new Bandwidth\Api\MultiChannelApi(
+ // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
+ // This is optional, `GuzzleHttp\Client` will be used as default.
+ new GuzzleHttp\Client(),
+ $config
+);
+$account_id = 9900000; // string | Your Bandwidth Account ID.
+$multi_channel_message_request = new \Bandwidth\Model\MultiChannelMessageRequest(); // \Bandwidth\Model\MultiChannelMessageRequest
+
+$hostIndex = 0;
+$variables = [
+];
+
+try {
+ $result = $apiInstance->createMultiChannelMessage($account_id, $multi_channel_message_request, $hostIndex, $variables);
+ print_r($result);
+} catch (Exception $e) {
+ echo 'Exception when calling MultiChannelApi->createMultiChannelMessage: ', $e->getMessage(), PHP_EOL;
+}
+```
+
+### Parameters
+
+| Name | Type | Description | Notes |
+| ------------- | ------------- | ------------- | ------------- |
+| **account_id** | **string**| Your Bandwidth Account ID. | |
+| **multi_channel_message_request** | [**\Bandwidth\Model\MultiChannelMessageRequest**](../Model/MultiChannelMessageRequest.md)| | |
+| hostIndex | null|int | Host index. Defaults to null. If null, then the library will use $this->hostIndex instead | [optional] |
+| variables | array | Associative array of variables to pass to the host. Defaults to empty array. | [optional] |
+
+### Return type
+
+[**\Bandwidth\Model\CreateMultiChannelMessageResponse**](../Model/CreateMultiChannelMessageResponse.md)
+
+### Authorization
+
+[Basic](../../README.md#Basic), [OAuth2](../../README.md#OAuth2)
+
+### HTTP request headers
+
+- **Content-Type**: `application/json`
+- **Accept**: `application/json`
+
+[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
+[[Back to Model list]](../../README.md#models)
+[[Back to README]](../../README.md)
diff --git a/docs/Api/PhoneNumberLookupApi.md b/docs/Api/PhoneNumberLookupApi.md
new file mode 100644
index 0000000..5eb609c
--- /dev/null
+++ b/docs/Api/PhoneNumberLookupApi.md
@@ -0,0 +1,232 @@
+# Bandwidth\PhoneNumberLookupApi
+
+All URIs are relative to http://localhost, except if the operation defines another base path.
+
+| Method | HTTP request | Description |
+| ------------- | ------------- | ------------- |
+| [**createAsyncBulkLookup()**](PhoneNumberLookupApi.md#createAsyncBulkLookup) | **POST** /accounts/{accountId}/phoneNumberLookup/bulk | Create Asynchronous Bulk Number Lookup |
+| [**createSyncLookup()**](PhoneNumberLookupApi.md#createSyncLookup) | **POST** /accounts/{accountId}/phoneNumberLookup | Create Synchronous Number Lookup |
+| [**getAsyncBulkLookup()**](PhoneNumberLookupApi.md#getAsyncBulkLookup) | **GET** /accounts/{accountId}/phoneNumberLookup/bulk/{requestId} | Get Asynchronous Bulk Number Lookup |
+
+
+## `createAsyncBulkLookup()`
+
+```php
+createAsyncBulkLookup($account_id, $async_lookup_request): \Bandwidth\Model\CreateAsyncBulkLookupResponse
+```
+### URI(s):
+- https://api.bandwidth.com/v2 Production
+Create Asynchronous Bulk Number Lookup
+
+Creates an asynchronous bulk phone number lookup request. Maximum of 15,000 telephone numbers per request. Use the [Get Asynchronous Bulk Number Lookup](#tag/Phone-Number-Lookup/operation/getAsyncBulkLookup) endpoint to check the status of the request and view the results.
+
+### Example
+
+```php
+setUsername('YOUR_USERNAME')
+ ->setPassword('YOUR_PASSWORD');
+
+// Configure OAuth2 access token for authorization: OAuth2
+$config = Bandwidth\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
+
+
+$apiInstance = new Bandwidth\Api\PhoneNumberLookupApi(
+ // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
+ // This is optional, `GuzzleHttp\Client` will be used as default.
+ new GuzzleHttp\Client(),
+ $config
+);
+$account_id = 9900000; // string
+$async_lookup_request = new \Bandwidth\Model\AsyncLookupRequest(); // \Bandwidth\Model\AsyncLookupRequest | Asynchronous bulk phone number lookup request.
+
+$hostIndex = 0;
+$variables = [
+];
+
+try {
+ $result = $apiInstance->createAsyncBulkLookup($account_id, $async_lookup_request, $hostIndex, $variables);
+ print_r($result);
+} catch (Exception $e) {
+ echo 'Exception when calling PhoneNumberLookupApi->createAsyncBulkLookup: ', $e->getMessage(), PHP_EOL;
+}
+```
+
+### Parameters
+
+| Name | Type | Description | Notes |
+| ------------- | ------------- | ------------- | ------------- |
+| **account_id** | **string**| | |
+| **async_lookup_request** | [**\Bandwidth\Model\AsyncLookupRequest**](../Model/AsyncLookupRequest.md)| Asynchronous bulk phone number lookup request. | |
+| hostIndex | null|int | Host index. Defaults to null. If null, then the library will use $this->hostIndex instead | [optional] |
+| variables | array | Associative array of variables to pass to the host. Defaults to empty array. | [optional] |
+
+### Return type
+
+[**\Bandwidth\Model\CreateAsyncBulkLookupResponse**](../Model/CreateAsyncBulkLookupResponse.md)
+
+### Authorization
+
+[Basic](../../README.md#Basic), [OAuth2](../../README.md#OAuth2)
+
+### HTTP request headers
+
+- **Content-Type**: `application/json`
+- **Accept**: `application/json`
+
+[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
+[[Back to Model list]](../../README.md#models)
+[[Back to README]](../../README.md)
+
+## `createSyncLookup()`
+
+```php
+createSyncLookup($account_id, $sync_lookup_request): \Bandwidth\Model\CreateSyncLookupResponse
+```
+### URI(s):
+- https://api.bandwidth.com/v2 Production
+Create Synchronous Number Lookup
+
+Creates a synchronous phone number lookup request. Maximum of 100 telephone numbers per request.
+
+### Example
+
+```php
+setUsername('YOUR_USERNAME')
+ ->setPassword('YOUR_PASSWORD');
+
+// Configure OAuth2 access token for authorization: OAuth2
+$config = Bandwidth\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
+
+
+$apiInstance = new Bandwidth\Api\PhoneNumberLookupApi(
+ // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
+ // This is optional, `GuzzleHttp\Client` will be used as default.
+ new GuzzleHttp\Client(),
+ $config
+);
+$account_id = 9900000; // string
+$sync_lookup_request = new \Bandwidth\Model\SyncLookupRequest(); // \Bandwidth\Model\SyncLookupRequest | Synchronous phone number lookup request.
+
+$hostIndex = 0;
+$variables = [
+];
+
+try {
+ $result = $apiInstance->createSyncLookup($account_id, $sync_lookup_request, $hostIndex, $variables);
+ print_r($result);
+} catch (Exception $e) {
+ echo 'Exception when calling PhoneNumberLookupApi->createSyncLookup: ', $e->getMessage(), PHP_EOL;
+}
+```
+
+### Parameters
+
+| Name | Type | Description | Notes |
+| ------------- | ------------- | ------------- | ------------- |
+| **account_id** | **string**| | |
+| **sync_lookup_request** | [**\Bandwidth\Model\SyncLookupRequest**](../Model/SyncLookupRequest.md)| Synchronous phone number lookup request. | |
+| hostIndex | null|int | Host index. Defaults to null. If null, then the library will use $this->hostIndex instead | [optional] |
+| variables | array | Associative array of variables to pass to the host. Defaults to empty array. | [optional] |
+
+### Return type
+
+[**\Bandwidth\Model\CreateSyncLookupResponse**](../Model/CreateSyncLookupResponse.md)
+
+### Authorization
+
+[Basic](../../README.md#Basic), [OAuth2](../../README.md#OAuth2)
+
+### HTTP request headers
+
+- **Content-Type**: `application/json`
+- **Accept**: `application/json`
+
+[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
+[[Back to Model list]](../../README.md#models)
+[[Back to README]](../../README.md)
+
+## `getAsyncBulkLookup()`
+
+```php
+getAsyncBulkLookup($account_id, $request_id): \Bandwidth\Model\GetAsyncBulkLookupResponse
+```
+### URI(s):
+- https://api.bandwidth.com/v2 Production
+Get Asynchronous Bulk Number Lookup
+
+Get an existing [Asynchronous Bulk Number Lookup](#tag/Phone-Number-Lookup/operation/createAsyncBulkLookup). Use this endpoint to check the status of the request and view the results.
+
+### Example
+
+```php
+setUsername('YOUR_USERNAME')
+ ->setPassword('YOUR_PASSWORD');
+
+// Configure OAuth2 access token for authorization: OAuth2
+$config = Bandwidth\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
+
+
+$apiInstance = new Bandwidth\Api\PhoneNumberLookupApi(
+ // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
+ // This is optional, `GuzzleHttp\Client` will be used as default.
+ new GuzzleHttp\Client(),
+ $config
+);
+$account_id = 9900000; // string
+$request_id = 004223a0-8b17-41b1-bf81-20732adf5590; // string
+
+$hostIndex = 0;
+$variables = [
+];
+
+try {
+ $result = $apiInstance->getAsyncBulkLookup($account_id, $request_id, $hostIndex, $variables);
+ print_r($result);
+} catch (Exception $e) {
+ echo 'Exception when calling PhoneNumberLookupApi->getAsyncBulkLookup: ', $e->getMessage(), PHP_EOL;
+}
+```
+
+### Parameters
+
+| Name | Type | Description | Notes |
+| ------------- | ------------- | ------------- | ------------- |
+| **account_id** | **string**| | |
+| **request_id** | **string**| | |
+| hostIndex | null|int | Host index. Defaults to null. If null, then the library will use $this->hostIndex instead | [optional] |
+| variables | array | Associative array of variables to pass to the host. Defaults to empty array. | [optional] |
+
+### Return type
+
+[**\Bandwidth\Model\GetAsyncBulkLookupResponse**](../Model/GetAsyncBulkLookupResponse.md)
+
+### Authorization
+
+[Basic](../../README.md#Basic), [OAuth2](../../README.md#OAuth2)
+
+### HTTP request headers
+
+- **Content-Type**: Not defined
+- **Accept**: `application/json`
+
+[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
+[[Back to Model list]](../../README.md#models)
+[[Back to README]](../../README.md)
diff --git a/docs/Api/RecordingsApi.md b/docs/Api/RecordingsApi.md
new file mode 100644
index 0000000..7a6a4b4
--- /dev/null
+++ b/docs/Api/RecordingsApi.md
@@ -0,0 +1,776 @@
+# Bandwidth\RecordingsApi
+
+All URIs are relative to http://localhost, except if the operation defines another base path.
+
+| Method | HTTP request | Description |
+| ------------- | ------------- | ------------- |
+| [**deleteRecording()**](RecordingsApi.md#deleteRecording) | **DELETE** /accounts/{accountId}/calls/{callId}/recordings/{recordingId} | Delete Recording |
+| [**deleteRecordingMedia()**](RecordingsApi.md#deleteRecordingMedia) | **DELETE** /accounts/{accountId}/calls/{callId}/recordings/{recordingId}/media | Delete Recording Media |
+| [**deleteRecordingTranscription()**](RecordingsApi.md#deleteRecordingTranscription) | **DELETE** /accounts/{accountId}/calls/{callId}/recordings/{recordingId}/transcription | Delete Transcription |
+| [**downloadCallRecording()**](RecordingsApi.md#downloadCallRecording) | **GET** /accounts/{accountId}/calls/{callId}/recordings/{recordingId}/media | Download Recording |
+| [**getCallRecording()**](RecordingsApi.md#getCallRecording) | **GET** /accounts/{accountId}/calls/{callId}/recordings/{recordingId} | Get Call Recording |
+| [**getRecordingTranscription()**](RecordingsApi.md#getRecordingTranscription) | **GET** /accounts/{accountId}/calls/{callId}/recordings/{recordingId}/transcription | Get Transcription |
+| [**listAccountCallRecordings()**](RecordingsApi.md#listAccountCallRecordings) | **GET** /accounts/{accountId}/recordings | Get Call Recordings |
+| [**listCallRecordings()**](RecordingsApi.md#listCallRecordings) | **GET** /accounts/{accountId}/calls/{callId}/recordings | List Call Recordings |
+| [**transcribeCallRecording()**](RecordingsApi.md#transcribeCallRecording) | **POST** /accounts/{accountId}/calls/{callId}/recordings/{recordingId}/transcription | Create Transcription Request |
+| [**updateCallRecordingState()**](RecordingsApi.md#updateCallRecordingState) | **PUT** /accounts/{accountId}/calls/{callId}/recording | Update Recording |
+
+
+## `deleteRecording()`
+
+```php
+deleteRecording($account_id, $call_id, $recording_id)
+```
+### URI(s):
+- https://voice.bandwidth.com/api/v2 Production
+Delete Recording
+
+Delete the recording information, media and transcription. Note: After the deletion is requested and a `204` is returned, neither the recording metadata nor the actual media nor its transcription will be accessible anymore. However, the media of the specified recording is not deleted immediately. This deletion process, while transparent and irreversible, can take an additional 24 to 48 hours.
+
+### Example
+
+```php
+setUsername('YOUR_USERNAME')
+ ->setPassword('YOUR_PASSWORD');
+
+// Configure OAuth2 access token for authorization: OAuth2
+$config = Bandwidth\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
+
+
+$apiInstance = new Bandwidth\Api\RecordingsApi(
+ // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
+ // This is optional, `GuzzleHttp\Client` will be used as default.
+ new GuzzleHttp\Client(),
+ $config
+);
+$account_id = 9900000; // string | Your Bandwidth Account ID.
+$call_id = c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85; // string | Programmable Voice API Call ID.
+$recording_id = r-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85; // string | Programmable Voice API Recording ID.
+
+$hostIndex = 0;
+$variables = [
+];
+
+try {
+ $apiInstance->deleteRecording($account_id, $call_id, $recording_id, $hostIndex, $variables);
+} catch (Exception $e) {
+ echo 'Exception when calling RecordingsApi->deleteRecording: ', $e->getMessage(), PHP_EOL;
+}
+```
+
+### Parameters
+
+| Name | Type | Description | Notes |
+| ------------- | ------------- | ------------- | ------------- |
+| **account_id** | **string**| Your Bandwidth Account ID. | |
+| **call_id** | **string**| Programmable Voice API Call ID. | |
+| **recording_id** | **string**| Programmable Voice API Recording ID. | |
+| hostIndex | null|int | Host index. Defaults to null. If null, then the library will use $this->hostIndex instead | [optional] |
+| variables | array | Associative array of variables to pass to the host. Defaults to empty array. | [optional] |
+
+### Return type
+
+void (empty response body)
+
+### Authorization
+
+[Basic](../../README.md#Basic), [OAuth2](../../README.md#OAuth2)
+
+### HTTP request headers
+
+- **Content-Type**: Not defined
+- **Accept**: `application/json`
+
+[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
+[[Back to Model list]](../../README.md#models)
+[[Back to README]](../../README.md)
+
+## `deleteRecordingMedia()`
+
+```php
+deleteRecordingMedia($account_id, $call_id, $recording_id)
+```
+### URI(s):
+- https://voice.bandwidth.com/api/v2 Production
+Delete Recording Media
+
+Deletes the specified recording's media.
+
+### Example
+
+```php
+setUsername('YOUR_USERNAME')
+ ->setPassword('YOUR_PASSWORD');
+
+// Configure OAuth2 access token for authorization: OAuth2
+$config = Bandwidth\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
+
+
+$apiInstance = new Bandwidth\Api\RecordingsApi(
+ // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
+ // This is optional, `GuzzleHttp\Client` will be used as default.
+ new GuzzleHttp\Client(),
+ $config
+);
+$account_id = 9900000; // string | Your Bandwidth Account ID.
+$call_id = c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85; // string | Programmable Voice API Call ID.
+$recording_id = r-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85; // string | Programmable Voice API Recording ID.
+
+$hostIndex = 0;
+$variables = [
+];
+
+try {
+ $apiInstance->deleteRecordingMedia($account_id, $call_id, $recording_id, $hostIndex, $variables);
+} catch (Exception $e) {
+ echo 'Exception when calling RecordingsApi->deleteRecordingMedia: ', $e->getMessage(), PHP_EOL;
+}
+```
+
+### Parameters
+
+| Name | Type | Description | Notes |
+| ------------- | ------------- | ------------- | ------------- |
+| **account_id** | **string**| Your Bandwidth Account ID. | |
+| **call_id** | **string**| Programmable Voice API Call ID. | |
+| **recording_id** | **string**| Programmable Voice API Recording ID. | |
+| hostIndex | null|int | Host index. Defaults to null. If null, then the library will use $this->hostIndex instead | [optional] |
+| variables | array | Associative array of variables to pass to the host. Defaults to empty array. | [optional] |
+
+### Return type
+
+void (empty response body)
+
+### Authorization
+
+[Basic](../../README.md#Basic), [OAuth2](../../README.md#OAuth2)
+
+### HTTP request headers
+
+- **Content-Type**: Not defined
+- **Accept**: `application/json`
+
+[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
+[[Back to Model list]](../../README.md#models)
+[[Back to README]](../../README.md)
+
+## `deleteRecordingTranscription()`
+
+```php
+deleteRecordingTranscription($account_id, $call_id, $recording_id)
+```
+### URI(s):
+- https://voice.bandwidth.com/api/v2 Production
+Delete Transcription
+
+Deletes the specified recording's transcription. Note: After the deletion is requested and a `204` is returned, the transcription will not be accessible anymore. However, it is not deleted immediately. This deletion process, while transparent and irreversible, can take an additional 24 to 48 hours.
+
+### Example
+
+```php
+setUsername('YOUR_USERNAME')
+ ->setPassword('YOUR_PASSWORD');
+
+// Configure OAuth2 access token for authorization: OAuth2
+$config = Bandwidth\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
+
+
+$apiInstance = new Bandwidth\Api\RecordingsApi(
+ // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
+ // This is optional, `GuzzleHttp\Client` will be used as default.
+ new GuzzleHttp\Client(),
+ $config
+);
+$account_id = 9900000; // string | Your Bandwidth Account ID.
+$call_id = c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85; // string | Programmable Voice API Call ID.
+$recording_id = r-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85; // string | Programmable Voice API Recording ID.
+
+$hostIndex = 0;
+$variables = [
+];
+
+try {
+ $apiInstance->deleteRecordingTranscription($account_id, $call_id, $recording_id, $hostIndex, $variables);
+} catch (Exception $e) {
+ echo 'Exception when calling RecordingsApi->deleteRecordingTranscription: ', $e->getMessage(), PHP_EOL;
+}
+```
+
+### Parameters
+
+| Name | Type | Description | Notes |
+| ------------- | ------------- | ------------- | ------------- |
+| **account_id** | **string**| Your Bandwidth Account ID. | |
+| **call_id** | **string**| Programmable Voice API Call ID. | |
+| **recording_id** | **string**| Programmable Voice API Recording ID. | |
+| hostIndex | null|int | Host index. Defaults to null. If null, then the library will use $this->hostIndex instead | [optional] |
+| variables | array | Associative array of variables to pass to the host. Defaults to empty array. | [optional] |
+
+### Return type
+
+void (empty response body)
+
+### Authorization
+
+[Basic](../../README.md#Basic), [OAuth2](../../README.md#OAuth2)
+
+### HTTP request headers
+
+- **Content-Type**: Not defined
+- **Accept**: `application/json`
+
+[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
+[[Back to Model list]](../../README.md#models)
+[[Back to README]](../../README.md)
+
+## `downloadCallRecording()`
+
+```php
+downloadCallRecording($account_id, $call_id, $recording_id): \SplFileObject
+```
+### URI(s):
+- https://voice.bandwidth.com/api/v2 Production
+Download Recording
+
+Downloads the specified recording.
+
+### Example
+
+```php
+setUsername('YOUR_USERNAME')
+ ->setPassword('YOUR_PASSWORD');
+
+// Configure OAuth2 access token for authorization: OAuth2
+$config = Bandwidth\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
+
+
+$apiInstance = new Bandwidth\Api\RecordingsApi(
+ // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
+ // This is optional, `GuzzleHttp\Client` will be used as default.
+ new GuzzleHttp\Client(),
+ $config
+);
+$account_id = 9900000; // string | Your Bandwidth Account ID.
+$call_id = c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85; // string | Programmable Voice API Call ID.
+$recording_id = r-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85; // string | Programmable Voice API Recording ID.
+
+$hostIndex = 0;
+$variables = [
+];
+
+try {
+ $result = $apiInstance->downloadCallRecording($account_id, $call_id, $recording_id, $hostIndex, $variables);
+ print_r($result);
+} catch (Exception $e) {
+ echo 'Exception when calling RecordingsApi->downloadCallRecording: ', $e->getMessage(), PHP_EOL;
+}
+```
+
+### Parameters
+
+| Name | Type | Description | Notes |
+| ------------- | ------------- | ------------- | ------------- |
+| **account_id** | **string**| Your Bandwidth Account ID. | |
+| **call_id** | **string**| Programmable Voice API Call ID. | |
+| **recording_id** | **string**| Programmable Voice API Recording ID. | |
+| hostIndex | null|int | Host index. Defaults to null. If null, then the library will use $this->hostIndex instead | [optional] |
+| variables | array | Associative array of variables to pass to the host. Defaults to empty array. | [optional] |
+
+### Return type
+
+**\SplFileObject**
+
+### Authorization
+
+[Basic](../../README.md#Basic), [OAuth2](../../README.md#OAuth2)
+
+### HTTP request headers
+
+- **Content-Type**: Not defined
+- **Accept**: `audio/vnd.wave`, `audio/mpeg`, `application/json`
+
+[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
+[[Back to Model list]](../../README.md#models)
+[[Back to README]](../../README.md)
+
+## `getCallRecording()`
+
+```php
+getCallRecording($account_id, $call_id, $recording_id): \Bandwidth\Model\CallRecordingMetadata
+```
+### URI(s):
+- https://voice.bandwidth.com/api/v2 Production
+Get Call Recording
+
+Returns metadata for the specified recording.
+
+### Example
+
+```php
+setUsername('YOUR_USERNAME')
+ ->setPassword('YOUR_PASSWORD');
+
+// Configure OAuth2 access token for authorization: OAuth2
+$config = Bandwidth\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
+
+
+$apiInstance = new Bandwidth\Api\RecordingsApi(
+ // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
+ // This is optional, `GuzzleHttp\Client` will be used as default.
+ new GuzzleHttp\Client(),
+ $config
+);
+$account_id = 9900000; // string | Your Bandwidth Account ID.
+$call_id = c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85; // string | Programmable Voice API Call ID.
+$recording_id = r-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85; // string | Programmable Voice API Recording ID.
+
+$hostIndex = 0;
+$variables = [
+];
+
+try {
+ $result = $apiInstance->getCallRecording($account_id, $call_id, $recording_id, $hostIndex, $variables);
+ print_r($result);
+} catch (Exception $e) {
+ echo 'Exception when calling RecordingsApi->getCallRecording: ', $e->getMessage(), PHP_EOL;
+}
+```
+
+### Parameters
+
+| Name | Type | Description | Notes |
+| ------------- | ------------- | ------------- | ------------- |
+| **account_id** | **string**| Your Bandwidth Account ID. | |
+| **call_id** | **string**| Programmable Voice API Call ID. | |
+| **recording_id** | **string**| Programmable Voice API Recording ID. | |
+| hostIndex | null|int | Host index. Defaults to null. If null, then the library will use $this->hostIndex instead | [optional] |
+| variables | array | Associative array of variables to pass to the host. Defaults to empty array. | [optional] |
+
+### Return type
+
+[**\Bandwidth\Model\CallRecordingMetadata**](../Model/CallRecordingMetadata.md)
+
+### Authorization
+
+[Basic](../../README.md#Basic), [OAuth2](../../README.md#OAuth2)
+
+### HTTP request headers
+
+- **Content-Type**: Not defined
+- **Accept**: `application/json`
+
+[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
+[[Back to Model list]](../../README.md#models)
+[[Back to README]](../../README.md)
+
+## `getRecordingTranscription()`
+
+```php
+getRecordingTranscription($account_id, $call_id, $recording_id): \Bandwidth\Model\RecordingTranscriptions
+```
+### URI(s):
+- https://voice.bandwidth.com/api/v2 Production
+Get Transcription
+
+Downloads the specified transcription. If the recording was multi-channel, then there will be 2 transcripts. The caller/called party transcript will be the first item while [``](/docs/voice/bxml/playAudio) and [``](/docs/voice/bxml/speakSentence) transcript will be the second item. During a [``](/docs/voice/bxml/transfer) the A-leg transcript will be the first item while the B-leg transcript will be the second item.
+
+### Example
+
+```php
+setUsername('YOUR_USERNAME')
+ ->setPassword('YOUR_PASSWORD');
+
+// Configure OAuth2 access token for authorization: OAuth2
+$config = Bandwidth\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
+
+
+$apiInstance = new Bandwidth\Api\RecordingsApi(
+ // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
+ // This is optional, `GuzzleHttp\Client` will be used as default.
+ new GuzzleHttp\Client(),
+ $config
+);
+$account_id = 9900000; // string | Your Bandwidth Account ID.
+$call_id = c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85; // string | Programmable Voice API Call ID.
+$recording_id = r-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85; // string | Programmable Voice API Recording ID.
+
+$hostIndex = 0;
+$variables = [
+];
+
+try {
+ $result = $apiInstance->getRecordingTranscription($account_id, $call_id, $recording_id, $hostIndex, $variables);
+ print_r($result);
+} catch (Exception $e) {
+ echo 'Exception when calling RecordingsApi->getRecordingTranscription: ', $e->getMessage(), PHP_EOL;
+}
+```
+
+### Parameters
+
+| Name | Type | Description | Notes |
+| ------------- | ------------- | ------------- | ------------- |
+| **account_id** | **string**| Your Bandwidth Account ID. | |
+| **call_id** | **string**| Programmable Voice API Call ID. | |
+| **recording_id** | **string**| Programmable Voice API Recording ID. | |
+| hostIndex | null|int | Host index. Defaults to null. If null, then the library will use $this->hostIndex instead | [optional] |
+| variables | array | Associative array of variables to pass to the host. Defaults to empty array. | [optional] |
+
+### Return type
+
+[**\Bandwidth\Model\RecordingTranscriptions**](../Model/RecordingTranscriptions.md)
+
+### Authorization
+
+[Basic](../../README.md#Basic), [OAuth2](../../README.md#OAuth2)
+
+### HTTP request headers
+
+- **Content-Type**: Not defined
+- **Accept**: `application/json`
+
+[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
+[[Back to Model list]](../../README.md#models)
+[[Back to README]](../../README.md)
+
+## `listAccountCallRecordings()`
+
+```php
+listAccountCallRecordings($account_id, $to, $from, $min_start_time, $max_start_time): \Bandwidth\Model\CallRecordingMetadata[]
+```
+### URI(s):
+- https://voice.bandwidth.com/api/v2 Production
+Get Call Recordings
+
+Returns a list of metadata for the recordings associated with the specified account. The list can be filtered by the optional from, to, minStartTime, and maxStartTime arguments. The list is capped at 1000 entries and may be empty if no recordings match the specified criteria.
+
+### Example
+
+```php
+setUsername('YOUR_USERNAME')
+ ->setPassword('YOUR_PASSWORD');
+
+// Configure OAuth2 access token for authorization: OAuth2
+$config = Bandwidth\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
+
+
+$apiInstance = new Bandwidth\Api\RecordingsApi(
+ // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
+ // This is optional, `GuzzleHttp\Client` will be used as default.
+ new GuzzleHttp\Client(),
+ $config
+);
+$account_id = 9900000; // string | Your Bandwidth Account ID.
+$to = %2b19195551234; // string | Filter results by the `to` field.
+$from = %2b19195554321; // string | Filter results by the `from` field.
+$min_start_time = 2022-06-21T19:13:21Z; // string | Filter results to recordings which have a `startTime` after or including `minStartTime` (in ISO8601 format).
+$max_start_time = 2022-06-21T19:13:21Z; // string | Filter results to recordings which have a `startTime` before `maxStartTime` (in ISO8601 format).
+
+$hostIndex = 0;
+$variables = [
+];
+
+try {
+ $result = $apiInstance->listAccountCallRecordings($account_id, $to, $from, $min_start_time, $max_start_time, $hostIndex, $variables);
+ print_r($result);
+} catch (Exception $e) {
+ echo 'Exception when calling RecordingsApi->listAccountCallRecordings: ', $e->getMessage(), PHP_EOL;
+}
+```
+
+### Parameters
+
+| Name | Type | Description | Notes |
+| ------------- | ------------- | ------------- | ------------- |
+| **account_id** | **string**| Your Bandwidth Account ID. | |
+| **to** | **string**| Filter results by the `to` field. | [optional] |
+| **from** | **string**| Filter results by the `from` field. | [optional] |
+| **min_start_time** | **string**| Filter results to recordings which have a `startTime` after or including `minStartTime` (in ISO8601 format). | [optional] |
+| **max_start_time** | **string**| Filter results to recordings which have a `startTime` before `maxStartTime` (in ISO8601 format). | [optional] |
+| hostIndex | null|int | Host index. Defaults to null. If null, then the library will use $this->hostIndex instead | [optional] |
+| variables | array | Associative array of variables to pass to the host. Defaults to empty array. | [optional] |
+
+### Return type
+
+[**\Bandwidth\Model\CallRecordingMetadata[]**](../Model/CallRecordingMetadata.md)
+
+### Authorization
+
+[Basic](../../README.md#Basic), [OAuth2](../../README.md#OAuth2)
+
+### HTTP request headers
+
+- **Content-Type**: Not defined
+- **Accept**: `application/json`
+
+[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
+[[Back to Model list]](../../README.md#models)
+[[Back to README]](../../README.md)
+
+## `listCallRecordings()`
+
+```php
+listCallRecordings($account_id, $call_id): \Bandwidth\Model\CallRecordingMetadata[]
+```
+### URI(s):
+- https://voice.bandwidth.com/api/v2 Production
+List Call Recordings
+
+Returns a (potentially empty) list of metadata for the recordings that took place during the specified call.
+
+### Example
+
+```php
+setUsername('YOUR_USERNAME')
+ ->setPassword('YOUR_PASSWORD');
+
+// Configure OAuth2 access token for authorization: OAuth2
+$config = Bandwidth\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
+
+
+$apiInstance = new Bandwidth\Api\RecordingsApi(
+ // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
+ // This is optional, `GuzzleHttp\Client` will be used as default.
+ new GuzzleHttp\Client(),
+ $config
+);
+$account_id = 9900000; // string | Your Bandwidth Account ID.
+$call_id = c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85; // string | Programmable Voice API Call ID.
+
+$hostIndex = 0;
+$variables = [
+];
+
+try {
+ $result = $apiInstance->listCallRecordings($account_id, $call_id, $hostIndex, $variables);
+ print_r($result);
+} catch (Exception $e) {
+ echo 'Exception when calling RecordingsApi->listCallRecordings: ', $e->getMessage(), PHP_EOL;
+}
+```
+
+### Parameters
+
+| Name | Type | Description | Notes |
+| ------------- | ------------- | ------------- | ------------- |
+| **account_id** | **string**| Your Bandwidth Account ID. | |
+| **call_id** | **string**| Programmable Voice API Call ID. | |
+| hostIndex | null|int | Host index. Defaults to null. If null, then the library will use $this->hostIndex instead | [optional] |
+| variables | array | Associative array of variables to pass to the host. Defaults to empty array. | [optional] |
+
+### Return type
+
+[**\Bandwidth\Model\CallRecordingMetadata[]**](../Model/CallRecordingMetadata.md)
+
+### Authorization
+
+[Basic](../../README.md#Basic), [OAuth2](../../README.md#OAuth2)
+
+### HTTP request headers
+
+- **Content-Type**: Not defined
+- **Accept**: `application/json`
+
+[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
+[[Back to Model list]](../../README.md#models)
+[[Back to README]](../../README.md)
+
+## `transcribeCallRecording()`
+
+```php
+transcribeCallRecording($account_id, $call_id, $recording_id, $transcribe_recording)
+```
+### URI(s):
+- https://voice.bandwidth.com/api/v2 Production
+Create Transcription Request
+
+Generate the transcription for a specific recording. Transcription can succeed only for recordings of length greater than 500 milliseconds and less than 4 hours.
+
+### Example
+
+```php
+setUsername('YOUR_USERNAME')
+ ->setPassword('YOUR_PASSWORD');
+
+// Configure OAuth2 access token for authorization: OAuth2
+$config = Bandwidth\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
+
+
+$apiInstance = new Bandwidth\Api\RecordingsApi(
+ // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
+ // This is optional, `GuzzleHttp\Client` will be used as default.
+ new GuzzleHttp\Client(),
+ $config
+);
+$account_id = 9900000; // string | Your Bandwidth Account ID.
+$call_id = c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85; // string | Programmable Voice API Call ID.
+$recording_id = r-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85; // string | Programmable Voice API Recording ID.
+$transcribe_recording = new \Bandwidth\Model\TranscribeRecording(); // \Bandwidth\Model\TranscribeRecording
+
+$hostIndex = 0;
+$variables = [
+];
+
+try {
+ $apiInstance->transcribeCallRecording($account_id, $call_id, $recording_id, $transcribe_recording, $hostIndex, $variables);
+} catch (Exception $e) {
+ echo 'Exception when calling RecordingsApi->transcribeCallRecording: ', $e->getMessage(), PHP_EOL;
+}
+```
+
+### Parameters
+
+| Name | Type | Description | Notes |
+| ------------- | ------------- | ------------- | ------------- |
+| **account_id** | **string**| Your Bandwidth Account ID. | |
+| **call_id** | **string**| Programmable Voice API Call ID. | |
+| **recording_id** | **string**| Programmable Voice API Recording ID. | |
+| **transcribe_recording** | [**\Bandwidth\Model\TranscribeRecording**](../Model/TranscribeRecording.md)| | |
+| hostIndex | null|int | Host index. Defaults to null. If null, then the library will use $this->hostIndex instead | [optional] |
+| variables | array | Associative array of variables to pass to the host. Defaults to empty array. | [optional] |
+
+### Return type
+
+void (empty response body)
+
+### Authorization
+
+[Basic](../../README.md#Basic), [OAuth2](../../README.md#OAuth2)
+
+### HTTP request headers
+
+- **Content-Type**: `application/json`
+- **Accept**: `application/json`
+
+[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
+[[Back to Model list]](../../README.md#models)
+[[Back to README]](../../README.md)
+
+## `updateCallRecordingState()`
+
+```php
+updateCallRecordingState($account_id, $call_id, $update_call_recording)
+```
+### URI(s):
+- https://voice.bandwidth.com/api/v2 Production
+Update Recording
+
+Pause or resume a recording on an active phone call.
+
+### Example
+
+```php
+setUsername('YOUR_USERNAME')
+ ->setPassword('YOUR_PASSWORD');
+
+// Configure OAuth2 access token for authorization: OAuth2
+$config = Bandwidth\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
+
+
+$apiInstance = new Bandwidth\Api\RecordingsApi(
+ // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
+ // This is optional, `GuzzleHttp\Client` will be used as default.
+ new GuzzleHttp\Client(),
+ $config
+);
+$account_id = 9900000; // string | Your Bandwidth Account ID.
+$call_id = c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85; // string | Programmable Voice API Call ID.
+$update_call_recording = new \Bandwidth\Model\UpdateCallRecording(); // \Bandwidth\Model\UpdateCallRecording
+
+$hostIndex = 0;
+$variables = [
+];
+
+try {
+ $apiInstance->updateCallRecordingState($account_id, $call_id, $update_call_recording, $hostIndex, $variables);
+} catch (Exception $e) {
+ echo 'Exception when calling RecordingsApi->updateCallRecordingState: ', $e->getMessage(), PHP_EOL;
+}
+```
+
+### Parameters
+
+| Name | Type | Description | Notes |
+| ------------- | ------------- | ------------- | ------------- |
+| **account_id** | **string**| Your Bandwidth Account ID. | |
+| **call_id** | **string**| Programmable Voice API Call ID. | |
+| **update_call_recording** | [**\Bandwidth\Model\UpdateCallRecording**](../Model/UpdateCallRecording.md)| | |
+| hostIndex | null|int | Host index. Defaults to null. If null, then the library will use $this->hostIndex instead | [optional] |
+| variables | array | Associative array of variables to pass to the host. Defaults to empty array. | [optional] |
+
+### Return type
+
+void (empty response body)
+
+### Authorization
+
+[Basic](../../README.md#Basic), [OAuth2](../../README.md#OAuth2)
+
+### HTTP request headers
+
+- **Content-Type**: `application/json`
+- **Accept**: `application/json`
+
+[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
+[[Back to Model list]](../../README.md#models)
+[[Back to README]](../../README.md)
diff --git a/docs/Api/StatisticsApi.md b/docs/Api/StatisticsApi.md
new file mode 100644
index 0000000..91dab58
--- /dev/null
+++ b/docs/Api/StatisticsApi.md
@@ -0,0 +1,80 @@
+# Bandwidth\StatisticsApi
+
+All URIs are relative to http://localhost, except if the operation defines another base path.
+
+| Method | HTTP request | Description |
+| ------------- | ------------- | ------------- |
+| [**getStatistics()**](StatisticsApi.md#getStatistics) | **GET** /accounts/{accountId}/statistics | Get Account Statistics |
+
+
+## `getStatistics()`
+
+```php
+getStatistics($account_id): \Bandwidth\Model\AccountStatistics
+```
+### URI(s):
+- https://voice.bandwidth.com/api/v2 Production
+Get Account Statistics
+
+Returns details about the current state of the account.
+
+### Example
+
+```php
+setUsername('YOUR_USERNAME')
+ ->setPassword('YOUR_PASSWORD');
+
+// Configure OAuth2 access token for authorization: OAuth2
+$config = Bandwidth\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
+
+
+$apiInstance = new Bandwidth\Api\StatisticsApi(
+ // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
+ // This is optional, `GuzzleHttp\Client` will be used as default.
+ new GuzzleHttp\Client(),
+ $config
+);
+$account_id = 9900000; // string | Your Bandwidth Account ID.
+
+$hostIndex = 0;
+$variables = [
+];
+
+try {
+ $result = $apiInstance->getStatistics($account_id, $hostIndex, $variables);
+ print_r($result);
+} catch (Exception $e) {
+ echo 'Exception when calling StatisticsApi->getStatistics: ', $e->getMessage(), PHP_EOL;
+}
+```
+
+### Parameters
+
+| Name | Type | Description | Notes |
+| ------------- | ------------- | ------------- | ------------- |
+| **account_id** | **string**| Your Bandwidth Account ID. | |
+| hostIndex | null|int | Host index. Defaults to null. If null, then the library will use $this->hostIndex instead | [optional] |
+| variables | array | Associative array of variables to pass to the host. Defaults to empty array. | [optional] |
+
+### Return type
+
+[**\Bandwidth\Model\AccountStatistics**](../Model/AccountStatistics.md)
+
+### Authorization
+
+[Basic](../../README.md#Basic), [OAuth2](../../README.md#OAuth2)
+
+### HTTP request headers
+
+- **Content-Type**: Not defined
+- **Accept**: `application/json`
+
+[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
+[[Back to Model list]](../../README.md#models)
+[[Back to README]](../../README.md)
diff --git a/docs/Api/TollFreeVerificationApi.md b/docs/Api/TollFreeVerificationApi.md
new file mode 100644
index 0000000..c4ca7f6
--- /dev/null
+++ b/docs/Api/TollFreeVerificationApi.md
@@ -0,0 +1,675 @@
+# Bandwidth\TollFreeVerificationApi
+
+All URIs are relative to http://localhost, except if the operation defines another base path.
+
+| Method | HTTP request | Description |
+| ------------- | ------------- | ------------- |
+| [**createWebhookSubscription()**](TollFreeVerificationApi.md#createWebhookSubscription) | **POST** /accounts/{accountId}/tollFreeVerification/webhooks/subscriptions | Create Webhook Subscription |
+| [**deleteVerificationRequest()**](TollFreeVerificationApi.md#deleteVerificationRequest) | **DELETE** /accounts/{accountId}/phoneNumbers/{phoneNumber}/tollFreeVerification | Delete a Toll-Free Verification Submission |
+| [**deleteWebhookSubscription()**](TollFreeVerificationApi.md#deleteWebhookSubscription) | **DELETE** /accounts/{accountId}/tollFreeVerification/webhooks/subscriptions/{id} | Delete Webhook Subscription |
+| [**getTollFreeVerificationStatus()**](TollFreeVerificationApi.md#getTollFreeVerificationStatus) | **GET** /accounts/{accountId}/phoneNumbers/{phoneNumber}/tollFreeVerification | Get Toll-Free Verification Status |
+| [**listTollFreeUseCases()**](TollFreeVerificationApi.md#listTollFreeUseCases) | **GET** /tollFreeVerification/useCases | List Toll-Free Use Cases |
+| [**listWebhookSubscriptions()**](TollFreeVerificationApi.md#listWebhookSubscriptions) | **GET** /accounts/{accountId}/tollFreeVerification/webhooks/subscriptions | List Webhook Subscriptions |
+| [**requestTollFreeVerification()**](TollFreeVerificationApi.md#requestTollFreeVerification) | **POST** /accounts/{accountId}/tollFreeVerification | Request Toll-Free Verification |
+| [**updateTollFreeVerificationRequest()**](TollFreeVerificationApi.md#updateTollFreeVerificationRequest) | **PUT** /accounts/{accountId}/phoneNumbers/{phoneNumber}/tollFreeVerification | Update Toll-Free Verification Request |
+| [**updateWebhookSubscription()**](TollFreeVerificationApi.md#updateWebhookSubscription) | **PUT** /accounts/{accountId}/tollFreeVerification/webhooks/subscriptions/{id} | Update Webhook Subscription |
+
+
+## `createWebhookSubscription()`
+
+```php
+createWebhookSubscription($account_id, $webhook_subscription_request_schema): \Bandwidth\Model\WebhookSubscription
+```
+### URI(s):
+- https://api.bandwidth.com/api/v2 Production
+Create Webhook Subscription
+
+Create a new webhook subscription (this webhook will be called for every update on every submission). In addition to a `callbackUrl`, this subscription can provide optional HTTP basic authentication credentials (a username and a password). The returned subscription object will contain an ID that can be used to modify or delete the subscription at a later time.
+
+### Example
+
+```php
+setUsername('YOUR_USERNAME')
+ ->setPassword('YOUR_PASSWORD');
+
+// Configure OAuth2 access token for authorization: OAuth2
+$config = Bandwidth\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
+
+
+$apiInstance = new Bandwidth\Api\TollFreeVerificationApi(
+ // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
+ // This is optional, `GuzzleHttp\Client` will be used as default.
+ new GuzzleHttp\Client(),
+ $config
+);
+$account_id = 9900000; // string | Your Bandwidth Account ID.
+$webhook_subscription_request_schema = new \Bandwidth\Model\WebhookSubscriptionRequestSchema(); // \Bandwidth\Model\WebhookSubscriptionRequestSchema | Information about a webhook that Bandwidth should send upon the completion of event customer is trying to subscribe to.
+
+$hostIndex = 0;
+$variables = [
+];
+
+try {
+ $result = $apiInstance->createWebhookSubscription($account_id, $webhook_subscription_request_schema, $hostIndex, $variables);
+ print_r($result);
+} catch (Exception $e) {
+ echo 'Exception when calling TollFreeVerificationApi->createWebhookSubscription: ', $e->getMessage(), PHP_EOL;
+}
+```
+
+### Parameters
+
+| Name | Type | Description | Notes |
+| ------------- | ------------- | ------------- | ------------- |
+| **account_id** | **string**| Your Bandwidth Account ID. | |
+| **webhook_subscription_request_schema** | [**\Bandwidth\Model\WebhookSubscriptionRequestSchema**](../Model/WebhookSubscriptionRequestSchema.md)| Information about a webhook that Bandwidth should send upon the completion of event customer is trying to subscribe to. | |
+| hostIndex | null|int | Host index. Defaults to null. If null, then the library will use $this->hostIndex instead | [optional] |
+| variables | array | Associative array of variables to pass to the host. Defaults to empty array. | [optional] |
+
+### Return type
+
+[**\Bandwidth\Model\WebhookSubscription**](../Model/WebhookSubscription.md)
+
+### Authorization
+
+[Basic](../../README.md#Basic), [OAuth2](../../README.md#OAuth2)
+
+### HTTP request headers
+
+- **Content-Type**: `application/json`
+- **Accept**: `application/json`
+
+[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
+[[Back to Model list]](../../README.md#models)
+[[Back to README]](../../README.md)
+
+## `deleteVerificationRequest()`
+
+```php
+deleteVerificationRequest($account_id, $phone_number)
+```
+### URI(s):
+- https://api.bandwidth.com/api/v2 Production
+Delete a Toll-Free Verification Submission
+
+Delete a toll-free verification submission for a toll-free number.
+
+### Example
+
+```php
+setUsername('YOUR_USERNAME')
+ ->setPassword('YOUR_PASSWORD');
+
+// Configure OAuth2 access token for authorization: OAuth2
+$config = Bandwidth\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
+
+
+$apiInstance = new Bandwidth\Api\TollFreeVerificationApi(
+ // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
+ // This is optional, `GuzzleHttp\Client` will be used as default.
+ new GuzzleHttp\Client(),
+ $config
+);
+$account_id = 9900000; // string | Your Bandwidth Account ID.
+$phone_number = +18885555555; // string | Valid Toll-Free telephone number in E.164 format.
+
+$hostIndex = 0;
+$variables = [
+];
+
+try {
+ $apiInstance->deleteVerificationRequest($account_id, $phone_number, $hostIndex, $variables);
+} catch (Exception $e) {
+ echo 'Exception when calling TollFreeVerificationApi->deleteVerificationRequest: ', $e->getMessage(), PHP_EOL;
+}
+```
+
+### Parameters
+
+| Name | Type | Description | Notes |
+| ------------- | ------------- | ------------- | ------------- |
+| **account_id** | **string**| Your Bandwidth Account ID. | |
+| **phone_number** | **string**| Valid Toll-Free telephone number in E.164 format. | |
+| hostIndex | null|int | Host index. Defaults to null. If null, then the library will use $this->hostIndex instead | [optional] |
+| variables | array | Associative array of variables to pass to the host. Defaults to empty array. | [optional] |
+
+### Return type
+
+void (empty response body)
+
+### Authorization
+
+[Basic](../../README.md#Basic), [OAuth2](../../README.md#OAuth2)
+
+### HTTP request headers
+
+- **Content-Type**: Not defined
+- **Accept**: `application/json`
+
+[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
+[[Back to Model list]](../../README.md#models)
+[[Back to README]](../../README.md)
+
+## `deleteWebhookSubscription()`
+
+```php
+deleteWebhookSubscription($account_id, $id)
+```
+### URI(s):
+- https://api.bandwidth.com/api/v2 Production
+Delete Webhook Subscription
+
+Delete a webhook subscription by ID.
+
+### Example
+
+```php
+setUsername('YOUR_USERNAME')
+ ->setPassword('YOUR_PASSWORD');
+
+// Configure OAuth2 access token for authorization: OAuth2
+$config = Bandwidth\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
+
+
+$apiInstance = new Bandwidth\Api\TollFreeVerificationApi(
+ // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
+ // This is optional, `GuzzleHttp\Client` will be used as default.
+ new GuzzleHttp\Client(),
+ $config
+);
+$account_id = 9900000; // string | Your Bandwidth Account ID.
+$id = 7bt57JcsVYJrN9K1OcV1Nu; // string | Webhook subscription ID
+
+$hostIndex = 0;
+$variables = [
+];
+
+try {
+ $apiInstance->deleteWebhookSubscription($account_id, $id, $hostIndex, $variables);
+} catch (Exception $e) {
+ echo 'Exception when calling TollFreeVerificationApi->deleteWebhookSubscription: ', $e->getMessage(), PHP_EOL;
+}
+```
+
+### Parameters
+
+| Name | Type | Description | Notes |
+| ------------- | ------------- | ------------- | ------------- |
+| **account_id** | **string**| Your Bandwidth Account ID. | |
+| **id** | **string**| Webhook subscription ID | |
+| hostIndex | null|int | Host index. Defaults to null. If null, then the library will use $this->hostIndex instead | [optional] |
+| variables | array | Associative array of variables to pass to the host. Defaults to empty array. | [optional] |
+
+### Return type
+
+void (empty response body)
+
+### Authorization
+
+[Basic](../../README.md#Basic), [OAuth2](../../README.md#OAuth2)
+
+### HTTP request headers
+
+- **Content-Type**: Not defined
+- **Accept**: `application/json`
+
+[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
+[[Back to Model list]](../../README.md#models)
+[[Back to README]](../../README.md)
+
+## `getTollFreeVerificationStatus()`
+
+```php
+getTollFreeVerificationStatus($account_id, $phone_number): \Bandwidth\Model\TfvStatus
+```
+### URI(s):
+- https://api.bandwidth.com/api/v2 Production
+Get Toll-Free Verification Status
+
+Gets the verification status for a phone number that is provisioned to your account. Submission information will be appended to the response if it is available.
+
+### Example
+
+```php
+setUsername('YOUR_USERNAME')
+ ->setPassword('YOUR_PASSWORD');
+
+// Configure OAuth2 access token for authorization: OAuth2
+$config = Bandwidth\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
+
+
+$apiInstance = new Bandwidth\Api\TollFreeVerificationApi(
+ // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
+ // This is optional, `GuzzleHttp\Client` will be used as default.
+ new GuzzleHttp\Client(),
+ $config
+);
+$account_id = 9900000; // string | Your Bandwidth Account ID.
+$phone_number = +18885555555; // string | Valid Toll-Free telephone number in E.164 format.
+
+$hostIndex = 0;
+$variables = [
+];
+
+try {
+ $result = $apiInstance->getTollFreeVerificationStatus($account_id, $phone_number, $hostIndex, $variables);
+ print_r($result);
+} catch (Exception $e) {
+ echo 'Exception when calling TollFreeVerificationApi->getTollFreeVerificationStatus: ', $e->getMessage(), PHP_EOL;
+}
+```
+
+### Parameters
+
+| Name | Type | Description | Notes |
+| ------------- | ------------- | ------------- | ------------- |
+| **account_id** | **string**| Your Bandwidth Account ID. | |
+| **phone_number** | **string**| Valid Toll-Free telephone number in E.164 format. | |
+| hostIndex | null|int | Host index. Defaults to null. If null, then the library will use $this->hostIndex instead | [optional] |
+| variables | array | Associative array of variables to pass to the host. Defaults to empty array. | [optional] |
+
+### Return type
+
+[**\Bandwidth\Model\TfvStatus**](../Model/TfvStatus.md)
+
+### Authorization
+
+[Basic](../../README.md#Basic), [OAuth2](../../README.md#OAuth2)
+
+### HTTP request headers
+
+- **Content-Type**: Not defined
+- **Accept**: `application/json`
+
+[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
+[[Back to Model list]](../../README.md#models)
+[[Back to README]](../../README.md)
+
+## `listTollFreeUseCases()`
+
+```php
+listTollFreeUseCases(): string[]
+```
+### URI(s):
+- https://api.bandwidth.com/api/v2 Production
+List Toll-Free Use Cases
+
+Lists valid toll-free use cases.
+
+### Example
+
+```php
+setUsername('YOUR_USERNAME')
+ ->setPassword('YOUR_PASSWORD');
+
+// Configure OAuth2 access token for authorization: OAuth2
+$config = Bandwidth\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
+
+
+$apiInstance = new Bandwidth\Api\TollFreeVerificationApi(
+ // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
+ // This is optional, `GuzzleHttp\Client` will be used as default.
+ new GuzzleHttp\Client(),
+ $config
+);
+
+$hostIndex = 0;
+$variables = [
+];
+
+try {
+ $result = $apiInstance->listTollFreeUseCases($hostIndex, $variables);
+ print_r($result);
+} catch (Exception $e) {
+ echo 'Exception when calling TollFreeVerificationApi->listTollFreeUseCases: ', $e->getMessage(), PHP_EOL;
+}
+```
+
+### Parameters
+
+This endpoint does not need any parameter.
+| hostIndex | null|int | Host index. Defaults to null. If null, then the library will use $this->hostIndex instead | [optional] |
+| variables | array | Associative array of variables to pass to the host. Defaults to empty array. | [optional] |
+
+### Return type
+
+**string[]**
+
+### Authorization
+
+[Basic](../../README.md#Basic), [OAuth2](../../README.md#OAuth2)
+
+### HTTP request headers
+
+- **Content-Type**: Not defined
+- **Accept**: `application/json`
+
+[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
+[[Back to Model list]](../../README.md#models)
+[[Back to README]](../../README.md)
+
+## `listWebhookSubscriptions()`
+
+```php
+listWebhookSubscriptions($account_id): \Bandwidth\Model\WebhookSubscriptionsListBody
+```
+### URI(s):
+- https://api.bandwidth.com/api/v2 Production
+List Webhook Subscriptions
+
+Lists all webhook subscriptions that are registered to receive status updates for the toll-free verification requests submitted under this account (password will not be returned through this API If `basicAuthentication` is defined, the `password` property of that object will be null).
+
+### Example
+
+```php
+setUsername('YOUR_USERNAME')
+ ->setPassword('YOUR_PASSWORD');
+
+// Configure OAuth2 access token for authorization: OAuth2
+$config = Bandwidth\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
+
+
+$apiInstance = new Bandwidth\Api\TollFreeVerificationApi(
+ // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
+ // This is optional, `GuzzleHttp\Client` will be used as default.
+ new GuzzleHttp\Client(),
+ $config
+);
+$account_id = 9900000; // string | Your Bandwidth Account ID.
+
+$hostIndex = 0;
+$variables = [
+];
+
+try {
+ $result = $apiInstance->listWebhookSubscriptions($account_id, $hostIndex, $variables);
+ print_r($result);
+} catch (Exception $e) {
+ echo 'Exception when calling TollFreeVerificationApi->listWebhookSubscriptions: ', $e->getMessage(), PHP_EOL;
+}
+```
+
+### Parameters
+
+| Name | Type | Description | Notes |
+| ------------- | ------------- | ------------- | ------------- |
+| **account_id** | **string**| Your Bandwidth Account ID. | |
+| hostIndex | null|int | Host index. Defaults to null. If null, then the library will use $this->hostIndex instead | [optional] |
+| variables | array | Associative array of variables to pass to the host. Defaults to empty array. | [optional] |
+
+### Return type
+
+[**\Bandwidth\Model\WebhookSubscriptionsListBody**](../Model/WebhookSubscriptionsListBody.md)
+
+### Authorization
+
+[Basic](../../README.md#Basic), [OAuth2](../../README.md#OAuth2)
+
+### HTTP request headers
+
+- **Content-Type**: Not defined
+- **Accept**: `application/json`
+
+[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
+[[Back to Model list]](../../README.md#models)
+[[Back to README]](../../README.md)
+
+## `requestTollFreeVerification()`
+
+```php
+requestTollFreeVerification($account_id, $verification_request)
+```
+### URI(s):
+- https://api.bandwidth.com/api/v2 Production
+Request Toll-Free Verification
+
+Submit a request for verification of a toll-free phone number.
+
+### Example
+
+```php
+setUsername('YOUR_USERNAME')
+ ->setPassword('YOUR_PASSWORD');
+
+// Configure OAuth2 access token for authorization: OAuth2
+$config = Bandwidth\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
+
+
+$apiInstance = new Bandwidth\Api\TollFreeVerificationApi(
+ // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
+ // This is optional, `GuzzleHttp\Client` will be used as default.
+ new GuzzleHttp\Client(),
+ $config
+);
+$account_id = 9900000; // string | Your Bandwidth Account ID.
+$verification_request = new \Bandwidth\Model\VerificationRequest(); // \Bandwidth\Model\VerificationRequest | Request for verification of a toll-free phone number.
+
+$hostIndex = 0;
+$variables = [
+];
+
+try {
+ $apiInstance->requestTollFreeVerification($account_id, $verification_request, $hostIndex, $variables);
+} catch (Exception $e) {
+ echo 'Exception when calling TollFreeVerificationApi->requestTollFreeVerification: ', $e->getMessage(), PHP_EOL;
+}
+```
+
+### Parameters
+
+| Name | Type | Description | Notes |
+| ------------- | ------------- | ------------- | ------------- |
+| **account_id** | **string**| Your Bandwidth Account ID. | |
+| **verification_request** | [**\Bandwidth\Model\VerificationRequest**](../Model/VerificationRequest.md)| Request for verification of a toll-free phone number. | |
+| hostIndex | null|int | Host index. Defaults to null. If null, then the library will use $this->hostIndex instead | [optional] |
+| variables | array | Associative array of variables to pass to the host. Defaults to empty array. | [optional] |
+
+### Return type
+
+void (empty response body)
+
+### Authorization
+
+[Basic](../../README.md#Basic), [OAuth2](../../README.md#OAuth2)
+
+### HTTP request headers
+
+- **Content-Type**: `application/json`
+- **Accept**: `application/json`
+
+[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
+[[Back to Model list]](../../README.md#models)
+[[Back to README]](../../README.md)
+
+## `updateTollFreeVerificationRequest()`
+
+```php
+updateTollFreeVerificationRequest($account_id, $phone_number, $tfv_submission_wrapper)
+```
+### URI(s):
+- https://api.bandwidth.com/api/v2 Production
+Update Toll-Free Verification Request
+
+Updates a toll-free verification request. Submissions are only eligible for resubmission for 7 days within being processed and if resubmission is allowed (resubmitAllowed field is true).
+
+### Example
+
+```php
+setUsername('YOUR_USERNAME')
+ ->setPassword('YOUR_PASSWORD');
+
+// Configure OAuth2 access token for authorization: OAuth2
+$config = Bandwidth\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
+
+
+$apiInstance = new Bandwidth\Api\TollFreeVerificationApi(
+ // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
+ // This is optional, `GuzzleHttp\Client` will be used as default.
+ new GuzzleHttp\Client(),
+ $config
+);
+$account_id = 9900000; // string | Your Bandwidth Account ID.
+$phone_number = +18885555555; // string | Valid Toll-Free telephone number in E.164 format.
+$tfv_submission_wrapper = new \Bandwidth\Model\TfvSubmissionWrapper(); // \Bandwidth\Model\TfvSubmissionWrapper | Update a request for verification of a toll-free phone number.
+
+$hostIndex = 0;
+$variables = [
+];
+
+try {
+ $apiInstance->updateTollFreeVerificationRequest($account_id, $phone_number, $tfv_submission_wrapper, $hostIndex, $variables);
+} catch (Exception $e) {
+ echo 'Exception when calling TollFreeVerificationApi->updateTollFreeVerificationRequest: ', $e->getMessage(), PHP_EOL;
+}
+```
+
+### Parameters
+
+| Name | Type | Description | Notes |
+| ------------- | ------------- | ------------- | ------------- |
+| **account_id** | **string**| Your Bandwidth Account ID. | |
+| **phone_number** | **string**| Valid Toll-Free telephone number in E.164 format. | |
+| **tfv_submission_wrapper** | [**\Bandwidth\Model\TfvSubmissionWrapper**](../Model/TfvSubmissionWrapper.md)| Update a request for verification of a toll-free phone number. | |
+| hostIndex | null|int | Host index. Defaults to null. If null, then the library will use $this->hostIndex instead | [optional] |
+| variables | array | Associative array of variables to pass to the host. Defaults to empty array. | [optional] |
+
+### Return type
+
+void (empty response body)
+
+### Authorization
+
+[Basic](../../README.md#Basic), [OAuth2](../../README.md#OAuth2)
+
+### HTTP request headers
+
+- **Content-Type**: `application/json`
+- **Accept**: `application/json`
+
+[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
+[[Back to Model list]](../../README.md#models)
+[[Back to README]](../../README.md)
+
+## `updateWebhookSubscription()`
+
+```php
+updateWebhookSubscription($account_id, $id, $webhook_subscription_request_schema): \Bandwidth\Model\WebhookSubscription
+```
+### URI(s):
+- https://api.bandwidth.com/api/v2 Production
+Update Webhook Subscription
+
+Update an existing webhook subscription (`callbackUrl` and `basicAuthentication` can be updated).
+
+### Example
+
+```php
+setUsername('YOUR_USERNAME')
+ ->setPassword('YOUR_PASSWORD');
+
+// Configure OAuth2 access token for authorization: OAuth2
+$config = Bandwidth\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
+
+
+$apiInstance = new Bandwidth\Api\TollFreeVerificationApi(
+ // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
+ // This is optional, `GuzzleHttp\Client` will be used as default.
+ new GuzzleHttp\Client(),
+ $config
+);
+$account_id = 9900000; // string | Your Bandwidth Account ID.
+$id = 7bt57JcsVYJrN9K1OcV1Nu; // string | Webhook subscription ID
+$webhook_subscription_request_schema = new \Bandwidth\Model\WebhookSubscriptionRequestSchema(); // \Bandwidth\Model\WebhookSubscriptionRequestSchema | Information about a webhook that Bandwidth should send upon the completion of event customer is trying to subscribe to.
+
+$hostIndex = 0;
+$variables = [
+];
+
+try {
+ $result = $apiInstance->updateWebhookSubscription($account_id, $id, $webhook_subscription_request_schema, $hostIndex, $variables);
+ print_r($result);
+} catch (Exception $e) {
+ echo 'Exception when calling TollFreeVerificationApi->updateWebhookSubscription: ', $e->getMessage(), PHP_EOL;
+}
+```
+
+### Parameters
+
+| Name | Type | Description | Notes |
+| ------------- | ------------- | ------------- | ------------- |
+| **account_id** | **string**| Your Bandwidth Account ID. | |
+| **id** | **string**| Webhook subscription ID | |
+| **webhook_subscription_request_schema** | [**\Bandwidth\Model\WebhookSubscriptionRequestSchema**](../Model/WebhookSubscriptionRequestSchema.md)| Information about a webhook that Bandwidth should send upon the completion of event customer is trying to subscribe to. | |
+| hostIndex | null|int | Host index. Defaults to null. If null, then the library will use $this->hostIndex instead | [optional] |
+| variables | array | Associative array of variables to pass to the host. Defaults to empty array. | [optional] |
+
+### Return type
+
+[**\Bandwidth\Model\WebhookSubscription**](../Model/WebhookSubscription.md)
+
+### Authorization
+
+[Basic](../../README.md#Basic), [OAuth2](../../README.md#OAuth2)
+
+### HTTP request headers
+
+- **Content-Type**: `application/json`
+- **Accept**: `application/json`
+
+[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
+[[Back to Model list]](../../README.md#models)
+[[Back to README]](../../README.md)
diff --git a/docs/Api/TranscriptionsApi.md b/docs/Api/TranscriptionsApi.md
new file mode 100644
index 0000000..0f10238
--- /dev/null
+++ b/docs/Api/TranscriptionsApi.md
@@ -0,0 +1,235 @@
+# Bandwidth\TranscriptionsApi
+
+All URIs are relative to http://localhost, except if the operation defines another base path.
+
+| Method | HTTP request | Description |
+| ------------- | ------------- | ------------- |
+| [**deleteRealTimeTranscription()**](TranscriptionsApi.md#deleteRealTimeTranscription) | **DELETE** /accounts/{accountId}/calls/{callId}/transcriptions/{transcriptionId} | Delete Real-time Transcription |
+| [**getRealTimeTranscription()**](TranscriptionsApi.md#getRealTimeTranscription) | **GET** /accounts/{accountId}/calls/{callId}/transcriptions/{transcriptionId} | Get Real-time Transcription |
+| [**listRealTimeTranscriptions()**](TranscriptionsApi.md#listRealTimeTranscriptions) | **GET** /accounts/{accountId}/calls/{callId}/transcriptions | List Real-time Transcriptions |
+
+
+## `deleteRealTimeTranscription()`
+
+```php
+deleteRealTimeTranscription($account_id, $call_id, $transcription_id)
+```
+### URI(s):
+- https://voice.bandwidth.com/api/v2 Production
+Delete Real-time Transcription
+
+Delete the specified transcription that was created on this call via [startTranscription](/docs/voice/bxml/startTranscription). Note: After the deletion is requested and a `200` is returned, the transcription will not be accessible anymore. However, it is not deleted immediately. This deletion process, while transparent and irreversible, can take an additional 24 to 48 hours.
+
+### Example
+
+```php
+setUsername('YOUR_USERNAME')
+ ->setPassword('YOUR_PASSWORD');
+
+// Configure OAuth2 access token for authorization: OAuth2
+$config = Bandwidth\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
+
+
+$apiInstance = new Bandwidth\Api\TranscriptionsApi(
+ // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
+ // This is optional, `GuzzleHttp\Client` will be used as default.
+ new GuzzleHttp\Client(),
+ $config
+);
+$account_id = 9900000; // string | Your Bandwidth Account ID.
+$call_id = c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85; // string | Programmable Voice API Call ID.
+$transcription_id = t-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85; // string | Programmable Voice API Transcription ID.
+
+$hostIndex = 0;
+$variables = [
+];
+
+try {
+ $apiInstance->deleteRealTimeTranscription($account_id, $call_id, $transcription_id, $hostIndex, $variables);
+} catch (Exception $e) {
+ echo 'Exception when calling TranscriptionsApi->deleteRealTimeTranscription: ', $e->getMessage(), PHP_EOL;
+}
+```
+
+### Parameters
+
+| Name | Type | Description | Notes |
+| ------------- | ------------- | ------------- | ------------- |
+| **account_id** | **string**| Your Bandwidth Account ID. | |
+| **call_id** | **string**| Programmable Voice API Call ID. | |
+| **transcription_id** | **string**| Programmable Voice API Transcription ID. | |
+| hostIndex | null|int | Host index. Defaults to null. If null, then the library will use $this->hostIndex instead | [optional] |
+| variables | array | Associative array of variables to pass to the host. Defaults to empty array. | [optional] |
+
+### Return type
+
+void (empty response body)
+
+### Authorization
+
+[Basic](../../README.md#Basic), [OAuth2](../../README.md#OAuth2)
+
+### HTTP request headers
+
+- **Content-Type**: Not defined
+- **Accept**: `application/json`
+
+[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
+[[Back to Model list]](../../README.md#models)
+[[Back to README]](../../README.md)
+
+## `getRealTimeTranscription()`
+
+```php
+getRealTimeTranscription($account_id, $call_id, $transcription_id): \Bandwidth\Model\CallTranscriptionResponse
+```
+### URI(s):
+- https://voice.bandwidth.com/api/v2 Production
+Get Real-time Transcription
+
+Retrieve the specified transcription that was created on this call via [startTranscription](/docs/voice/bxml/startTranscription).
+
+### Example
+
+```php
+setUsername('YOUR_USERNAME')
+ ->setPassword('YOUR_PASSWORD');
+
+// Configure OAuth2 access token for authorization: OAuth2
+$config = Bandwidth\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
+
+
+$apiInstance = new Bandwidth\Api\TranscriptionsApi(
+ // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
+ // This is optional, `GuzzleHttp\Client` will be used as default.
+ new GuzzleHttp\Client(),
+ $config
+);
+$account_id = 9900000; // string | Your Bandwidth Account ID.
+$call_id = c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85; // string | Programmable Voice API Call ID.
+$transcription_id = t-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85; // string | Programmable Voice API Transcription ID.
+
+$hostIndex = 0;
+$variables = [
+];
+
+try {
+ $result = $apiInstance->getRealTimeTranscription($account_id, $call_id, $transcription_id, $hostIndex, $variables);
+ print_r($result);
+} catch (Exception $e) {
+ echo 'Exception when calling TranscriptionsApi->getRealTimeTranscription: ', $e->getMessage(), PHP_EOL;
+}
+```
+
+### Parameters
+
+| Name | Type | Description | Notes |
+| ------------- | ------------- | ------------- | ------------- |
+| **account_id** | **string**| Your Bandwidth Account ID. | |
+| **call_id** | **string**| Programmable Voice API Call ID. | |
+| **transcription_id** | **string**| Programmable Voice API Transcription ID. | |
+| hostIndex | null|int | Host index. Defaults to null. If null, then the library will use $this->hostIndex instead | [optional] |
+| variables | array | Associative array of variables to pass to the host. Defaults to empty array. | [optional] |
+
+### Return type
+
+[**\Bandwidth\Model\CallTranscriptionResponse**](../Model/CallTranscriptionResponse.md)
+
+### Authorization
+
+[Basic](../../README.md#Basic), [OAuth2](../../README.md#OAuth2)
+
+### HTTP request headers
+
+- **Content-Type**: Not defined
+- **Accept**: `application/json`
+
+[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
+[[Back to Model list]](../../README.md#models)
+[[Back to README]](../../README.md)
+
+## `listRealTimeTranscriptions()`
+
+```php
+listRealTimeTranscriptions($account_id, $call_id): \Bandwidth\Model\CallTranscriptionMetadata[]
+```
+### URI(s):
+- https://voice.bandwidth.com/api/v2 Production
+List Real-time Transcriptions
+
+List the transcriptions created on this call via [startTranscription](/docs/voice/bxml/startTranscription).
+
+### Example
+
+```php
+setUsername('YOUR_USERNAME')
+ ->setPassword('YOUR_PASSWORD');
+
+// Configure OAuth2 access token for authorization: OAuth2
+$config = Bandwidth\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
+
+
+$apiInstance = new Bandwidth\Api\TranscriptionsApi(
+ // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
+ // This is optional, `GuzzleHttp\Client` will be used as default.
+ new GuzzleHttp\Client(),
+ $config
+);
+$account_id = 9900000; // string | Your Bandwidth Account ID.
+$call_id = c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85; // string | Programmable Voice API Call ID.
+
+$hostIndex = 0;
+$variables = [
+];
+
+try {
+ $result = $apiInstance->listRealTimeTranscriptions($account_id, $call_id, $hostIndex, $variables);
+ print_r($result);
+} catch (Exception $e) {
+ echo 'Exception when calling TranscriptionsApi->listRealTimeTranscriptions: ', $e->getMessage(), PHP_EOL;
+}
+```
+
+### Parameters
+
+| Name | Type | Description | Notes |
+| ------------- | ------------- | ------------- | ------------- |
+| **account_id** | **string**| Your Bandwidth Account ID. | |
+| **call_id** | **string**| Programmable Voice API Call ID. | |
+| hostIndex | null|int | Host index. Defaults to null. If null, then the library will use $this->hostIndex instead | [optional] |
+| variables | array | Associative array of variables to pass to the host. Defaults to empty array. | [optional] |
+
+### Return type
+
+[**\Bandwidth\Model\CallTranscriptionMetadata[]**](../Model/CallTranscriptionMetadata.md)
+
+### Authorization
+
+[Basic](../../README.md#Basic), [OAuth2](../../README.md#OAuth2)
+
+### HTTP request headers
+
+- **Content-Type**: Not defined
+- **Accept**: `application/json`
+
+[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
+[[Back to Model list]](../../README.md#models)
+[[Back to README]](../../README.md)
diff --git a/docs/Model/AccountStatistics.md b/docs/Model/AccountStatistics.md
new file mode 100644
index 0000000..e3681ab
--- /dev/null
+++ b/docs/Model/AccountStatistics.md
@@ -0,0 +1,10 @@
+# AccountStatistics
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**current_call_queue_size** | **int** | The number of calls currently enqueued. | [optional]
+**max_call_queue_size** | **int** | The maximum size of the queue before outgoing calls start being rejected. | [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/AdditionalDenialReason.md b/docs/Model/AdditionalDenialReason.md
new file mode 100644
index 0000000..f415166
--- /dev/null
+++ b/docs/Model/AdditionalDenialReason.md
@@ -0,0 +1,11 @@
+# AdditionalDenialReason
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**status_code** | **int** | Reason code for denial. |
+**reason** | **string** | Explanation for why a verification request was declined. |
+**resubmit_allowed** | **bool** | Whether a Toll-Free Verification request qualifies for resubmission via PUT. |
+
+[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
diff --git a/docs/Model/Address.md b/docs/Model/Address.md
new file mode 100644
index 0000000..622be5b
--- /dev/null
+++ b/docs/Model/Address.md
@@ -0,0 +1,15 @@
+# Address
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**name** | **string** | The name of the business using the toll-free number. |
+**addr1** | **string** | The address of the business using the toll-free number. |
+**addr2** | **string** | The address of the business using the toll-free number. | [optional]
+**city** | **string** | The city of the business using the toll-free number. |
+**state** | **string** | The state of the business using the toll-free number. |
+**zip** | **string** | The zip of the business using the toll-free number. |
+**url** | **string** | The website of the business using the toll-free number. |
+
+[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
diff --git a/docs/Model/AnswerCallback.md b/docs/Model/AnswerCallback.md
new file mode 100644
index 0000000..3c3bd60
--- /dev/null
+++ b/docs/Model/AnswerCallback.md
@@ -0,0 +1,22 @@
+# AnswerCallback
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**event_type** | **string** | The event type, value can be one of the following: answer, bridgeComplete, bridgeTargetComplete, conferenceCreated, conferenceRedirect, conferenceMemberJoin, conferenceMemberExit, conferenceCompleted, conferenceRecordingAvailable, disconnect, dtmf, gather, initiate, machineDetectionComplete, recordingComplete, recordingAvailable, redirect, transcriptionAvailable, transferAnswer, transferComplete, transferDisconnect. | [optional]
+**event_time** | **\DateTime** | The approximate UTC date and time when the event was generated by the Bandwidth server, in ISO 8601 format. This may not be exactly the time of event execution. | [optional]
+**account_id** | **string** | The user account associated with the call. | [optional]
+**application_id** | **string** | The id of the application associated with the call. | [optional]
+**from** | **string** | The provided identifier of the caller. Must be a phone number in E.164 format (e.g. +15555555555). | [optional]
+**to** | **string** | The phone number that received the call, in E.164 format (e.g. +15555555555). | [optional]
+**direction** | [**\Bandwidth\Model\CallDirectionEnum**](CallDirectionEnum.md) | | [optional]
+**call_id** | **string** | The call id associated with the event. | [optional]
+**call_url** | **string** | The URL of the call associated with the event. | [optional]
+**enqueued_time** | **\DateTime** | (optional) If call queueing is enabled and this is an outbound call, time the call was queued, in ISO 8601 format. | [optional]
+**start_time** | **\DateTime** | Time the call was started, in ISO 8601 format. | [optional]
+**answer_time** | **\DateTime** | Time the call was answered, in ISO 8601 format. | [optional]
+**tag** | **string** | (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present. | [optional]
+**machine_detection_result** | [**\Bandwidth\Model\MachineDetectionResult**](MachineDetectionResult.md) | | [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/AsyncLookupRequest.md b/docs/Model/AsyncLookupRequest.md
new file mode 100644
index 0000000..c3afbb4
--- /dev/null
+++ b/docs/Model/AsyncLookupRequest.md
@@ -0,0 +1,9 @@
+# AsyncLookupRequest
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**phone_numbers** | **string[]** | Telephone numbers in E.164 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/BlockedWebhook.md b/docs/Model/BlockedWebhook.md
new file mode 100644
index 0000000..8e2a9a0
--- /dev/null
+++ b/docs/Model/BlockedWebhook.md
@@ -0,0 +1,14 @@
+# BlockedWebhook
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**account_id** | **string** | User's account ID. | [optional]
+**phone_number** | **string** | Toll-free telephone number in E.164 format. | [optional]
+**status** | [**\Bandwidth\Model\TfvCallbackStatusEnum**](TfvCallbackStatusEnum.md) | | [optional]
+**internal_ticket_number** | **string** | Unique identifier (UUID) generated by Bandwidth to assist in tracking the verification status of a toll-free number. | [optional]
+**blocked** | **bool** | Whether a Toll-Free Verification is blocked. This attribute will only be defined when the number is blocked. | [optional]
+**blocked_reason** | **string** | The reason why the Toll-Free Verification is blocked. This attribute will only be defined when the number is blocked. | [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/BridgeCompleteCallback.md b/docs/Model/BridgeCompleteCallback.md
new file mode 100644
index 0000000..107200d
--- /dev/null
+++ b/docs/Model/BridgeCompleteCallback.md
@@ -0,0 +1,24 @@
+# BridgeCompleteCallback
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**event_type** | **string** | The event type, value can be one of the following: answer, bridgeComplete, bridgeTargetComplete, conferenceCreated, conferenceRedirect, conferenceMemberJoin, conferenceMemberExit, conferenceCompleted, conferenceRecordingAvailable, disconnect, dtmf, gather, initiate, machineDetectionComplete, recordingComplete, recordingAvailable, redirect, transcriptionAvailable, transferAnswer, transferComplete, transferDisconnect. | [optional]
+**event_time** | **\DateTime** | The approximate UTC date and time when the event was generated by the Bandwidth server, in ISO 8601 format. This may not be exactly the time of event execution. | [optional]
+**account_id** | **string** | The user account associated with the call. | [optional]
+**application_id** | **string** | The id of the application associated with the call. | [optional]
+**from** | **string** | The provided identifier of the caller. Must be a phone number in E.164 format (e.g. +15555555555). | [optional]
+**to** | **string** | The phone number that received the call, in E.164 format (e.g. +15555555555). | [optional]
+**direction** | [**\Bandwidth\Model\CallDirectionEnum**](CallDirectionEnum.md) | | [optional]
+**call_id** | **string** | The call id associated with the event. | [optional]
+**call_url** | **string** | The URL of the call associated with the event. | [optional]
+**enqueued_time** | **\DateTime** | (optional) If call queueing is enabled and this is an outbound call, time the call was queued, in ISO 8601 format. | [optional]
+**start_time** | **\DateTime** | Time the call was started, in ISO 8601 format. | [optional]
+**answer_time** | **\DateTime** | Time the call was answered, in ISO 8601 format. | [optional]
+**tag** | **string** | (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present. | [optional]
+**cause** | **string** | Reason the call failed - hangup, busy, timeout, cancel, rejected, callback-error, invalid-bxml, application-error, account-limit, node-capacity-exceeded, error, or unknown. | [optional]
+**error_message** | **string** | Text explaining the reason that caused the call to fail in case of errors. | [optional]
+**error_id** | **string** | Bandwidth's internal id that references the error event. | [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/BridgeTargetCompleteCallback.md b/docs/Model/BridgeTargetCompleteCallback.md
new file mode 100644
index 0000000..53f2e21
--- /dev/null
+++ b/docs/Model/BridgeTargetCompleteCallback.md
@@ -0,0 +1,21 @@
+# BridgeTargetCompleteCallback
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**event_type** | **string** | The event type, value can be one of the following: answer, bridgeComplete, bridgeTargetComplete, conferenceCreated, conferenceRedirect, conferenceMemberJoin, conferenceMemberExit, conferenceCompleted, conferenceRecordingAvailable, disconnect, dtmf, gather, initiate, machineDetectionComplete, recordingComplete, recordingAvailable, redirect, transcriptionAvailable, transferAnswer, transferComplete, transferDisconnect. | [optional]
+**event_time** | **\DateTime** | The approximate UTC date and time when the event was generated by the Bandwidth server, in ISO 8601 format. This may not be exactly the time of event execution. | [optional]
+**account_id** | **string** | The user account associated with the call. | [optional]
+**application_id** | **string** | The id of the application associated with the call. | [optional]
+**from** | **string** | The provided identifier of the caller. Must be a phone number in E.164 format (e.g. +15555555555). | [optional]
+**to** | **string** | The phone number that received the call, in E.164 format (e.g. +15555555555). | [optional]
+**direction** | [**\Bandwidth\Model\CallDirectionEnum**](CallDirectionEnum.md) | | [optional]
+**call_id** | **string** | The call id associated with the event. | [optional]
+**call_url** | **string** | The URL of the call associated with the event. | [optional]
+**enqueued_time** | **\DateTime** | (optional) If call queueing is enabled and this is an outbound call, time the call was queued, in ISO 8601 format. | [optional]
+**start_time** | **\DateTime** | Time the call was started, in ISO 8601 format. | [optional]
+**answer_time** | **\DateTime** | Time the call was answered, in ISO 8601 format. | [optional]
+**tag** | **string** | (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present. | [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/BrtcError.md b/docs/Model/BrtcError.md
new file mode 100644
index 0000000..8d504be
--- /dev/null
+++ b/docs/Model/BrtcError.md
@@ -0,0 +1,13 @@
+# BrtcError
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**id** | **string** | A unique identifier for the error. | [optional]
+**type** | **string** | The type of error. |
+**description** | **string** | A description of the error. |
+**code** | **string** | A code that uniquely identifies the error. | [optional]
+**source** | [**\Bandwidth\Model\BrtcErrorSource**](BrtcErrorSource.md) | | [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/BrtcErrorResponse.md b/docs/Model/BrtcErrorResponse.md
new file mode 100644
index 0000000..3e8a9cd
--- /dev/null
+++ b/docs/Model/BrtcErrorResponse.md
@@ -0,0 +1,11 @@
+# BrtcErrorResponse
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**links** | [**\Bandwidth\Model\BrtcLink[]**](BrtcLink.md) | |
+**data** | **object** | |
+**errors** | [**\Bandwidth\Model\BrtcError[]**](BrtcError.md) | |
+
+[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
diff --git a/docs/Model/BrtcErrorSource.md b/docs/Model/BrtcErrorSource.md
new file mode 100644
index 0000000..62b8ae5
--- /dev/null
+++ b/docs/Model/BrtcErrorSource.md
@@ -0,0 +1,12 @@
+# BrtcErrorSource
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**parameter** | **string** | The URI parameter that caused the error. | [optional]
+**field** | **string** | The request body field that caused the error. | [optional]
+**header** | **string** | The header that caused the error. | [optional]
+**reference** | **string** | The resource ID or path to the resource (or non-existent resource) causing the error. | [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/BrtcLink.md b/docs/Model/BrtcLink.md
new file mode 100644
index 0000000..50f4249
--- /dev/null
+++ b/docs/Model/BrtcLink.md
@@ -0,0 +1,11 @@
+# BrtcLink
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**href** | **string** | The full URL of the link. | [optional]
+**rel** | **string** | The relationship of the link to the current resource. | [optional]
+**method** | **string** | The HTTP method to use when making the request. | [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/BusinessEntityTypeEnum.md b/docs/Model/BusinessEntityTypeEnum.md
new file mode 100644
index 0000000..f279aee
--- /dev/null
+++ b/docs/Model/BusinessEntityTypeEnum.md
@@ -0,0 +1,8 @@
+# BusinessEntityTypeEnum
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+
+[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
diff --git a/docs/Model/BusinessRegistrationTypeEnum.md b/docs/Model/BusinessRegistrationTypeEnum.md
new file mode 100644
index 0000000..ee8ba41
--- /dev/null
+++ b/docs/Model/BusinessRegistrationTypeEnum.md
@@ -0,0 +1,8 @@
+# BusinessRegistrationTypeEnum
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+
+[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
diff --git a/docs/Model/CallDirectionEnum.md b/docs/Model/CallDirectionEnum.md
new file mode 100644
index 0000000..754d6d7
--- /dev/null
+++ b/docs/Model/CallDirectionEnum.md
@@ -0,0 +1,8 @@
+# CallDirectionEnum
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+
+[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
diff --git a/docs/Model/CallRecordingMetadata.md b/docs/Model/CallRecordingMetadata.md
new file mode 100644
index 0000000..96da31f
--- /dev/null
+++ b/docs/Model/CallRecordingMetadata.md
@@ -0,0 +1,27 @@
+# CallRecordingMetadata
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**application_id** | **string** | The id of the application associated with the call. | [optional]
+**account_id** | **string** | The user account associated with the call. | [optional]
+**call_id** | **string** | The call id associated with the event. | [optional]
+**parent_call_id** | **string** | (optional) If the event is related to the B leg of a <Transfer>, the call id of the original call leg that executed the <Transfer>. Otherwise, this field will not be present. | [optional]
+**recording_id** | **string** | The unique ID of this recording | [optional]
+**to** | **string** | The phone number that received the call, in E.164 format (e.g. +15555555555). | [optional]
+**from** | **string** | The provided identifier of the caller. Must be a phone number in E.164 format (e.g. +15555555555). | [optional]
+**transfer_caller_id** | **string** | The phone number used as the from field of the B-leg call, in E.164 format (e.g. +15555555555). | [optional]
+**transfer_to** | **string** | The phone number used as the to field of the B-leg call, in E.164 format (e.g. +15555555555). | [optional]
+**duration** | **string** | The duration of the recording in ISO-8601 format | [optional]
+**direction** | [**\Bandwidth\Model\CallDirectionEnum**](CallDirectionEnum.md) | | [optional]
+**channels** | **int** | Always `1` for conference recordings; multi-channel recordings are not supported on conferences. | [optional]
+**start_time** | **\DateTime** | Time the call was started, in ISO 8601 format. | [optional]
+**end_time** | **\DateTime** | The time that the recording ended in ISO-8601 format | [optional]
+**file_format** | [**\Bandwidth\Model\FileFormatEnum**](FileFormatEnum.md) | | [optional]
+**status** | **string** | The current status of the process. For recording, current possible values are 'processing', 'partial', 'complete', 'deleted', and 'error'. For transcriptions, current possible values are 'none', 'processing', 'available', 'error', 'timeout', 'file-size-too-big', and 'file-size-too-small'. Additional states may be added in the future, so your application must be tolerant of unknown values. | [optional]
+**media_url** | **string** | The URL that can be used to download the recording. Only present if the recording is finished and may be downloaded. | [optional]
+**transcription** | [**\Bandwidth\Model\RecordingTranscriptionMetadata**](RecordingTranscriptionMetadata.md) | | [optional]
+**recording_name** | **string** | A name to identify this recording. | [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/CallState.md b/docs/Model/CallState.md
new file mode 100644
index 0000000..9dc6923
--- /dev/null
+++ b/docs/Model/CallState.md
@@ -0,0 +1,26 @@
+# CallState
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**application_id** | **string** | The application id associated with the call. | [optional]
+**account_id** | **string** | The account id associated with the call. | [optional]
+**call_id** | **string** | The programmable voice API call ID. | [optional]
+**parent_call_id** | **string** | The A-leg call id, set only if this call is the B-leg of a [`<Transfer>`](/docs/voice/bxml/transfer). | [optional]
+**to** | **string** | The phone number that received the call, in E.164 format (e.g. +15555555555), or if the call was to a SIP URI, the SIP URI. | [optional]
+**from** | **string** | The phone number that made the call, in E.164 format (e.g. +15555555555). | [optional]
+**direction** | [**\Bandwidth\Model\CallDirectionEnum**](CallDirectionEnum.md) | | [optional]
+**state** | **string** | The current state of the call. Current possible values are `queued`, `initiated`, `answered` and `disconnected`. Additional states may be added in the future, so your application must be tolerant of unknown values. | [optional]
+**stir_shaken** | **array** | For inbound calls, the Bandwidth STIR/SHAKEN implementation will verify the information provided in the inbound invite request `Identity` header. The verification status is stored in the call state `stirShaken` property as follows. | Property | Description | |:------------------|:------------| | verstat | (optional) The verification status indicating whether the verification was successful or not. Possible values are `TN-Validation-Passed` or `TN-Validation-Failed`. | | attestationIndicator | (optional) The attestation level verified by Bandwidth. Possible values are `A` (full), `B` (partial) or `C` (gateway). | | originatingId | (optional) A unique origination identifier. | Note that these are common properties but that the `stirShaken` object is free form and can contain other key-value pairs. More information: [Understanding STIR/SHAKEN](https://www.bandwidth.com/regulations/stir-shaken). | [optional]
+**identity** | **string** | The value of the `Identity` header from the inbound invite request. Only present for inbound calls and if the account is configured to forward this header. | [optional]
+**enqueued_time** | **\DateTime** | The time this call was placed in queue. | [optional]
+**start_time** | **\DateTime** | The time the call was initiated, in ISO 8601 format. `null` if the call is still in your queue. | [optional]
+**answer_time** | **\DateTime** | Populated once the call has been answered, with the time in ISO 8601 format. | [optional]
+**end_time** | **\DateTime** | Populated once the call has ended, with the time in ISO 8601 format. | [optional]
+**disconnect_cause** | **string** | | Cause | Description | |:------|:------------| | `hangup`| One party hung up the call, a [`<Hangup>`](../../bxml/verbs/hangup.md) verb was executed, or there was no more BXML to execute; it indicates that the call ended normally. | | `busy` | Callee was busy. | | `timeout` | Call wasn't answered before the `callTimeout` was reached. | | `cancel` | Call was cancelled by its originator while it was ringing. | | `rejected` | Call was rejected by the callee. | | `callback-error` | BXML callback couldn't be delivered to your callback server. | | `invalid-bxml` | Invalid BXML was returned in response to a callback. | | `application-error` | An unsupported action was tried on the call, e.g. trying to play a .ogg audio. | | `account-limit` | Account rate limits were reached. | | `node-capacity-exceeded` | System maximum capacity was reached. | | `error` | Some error not described in any of the other causes happened on the call. | | `unknown` | Unknown error happened on the call. | Note: This list is not exhaustive and other values can appear in the future. | [optional]
+**error_message** | **string** | Populated only if the call ended with an error, with text explaining the reason. | [optional]
+**error_id** | **string** | Populated only if the call ended with an error, with a Bandwidth internal id that references the error event. | [optional]
+**last_update** | **\DateTime** | The last time the call had a state update, in ISO 8601 format. | [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/CallStateEnum.md b/docs/Model/CallStateEnum.md
new file mode 100644
index 0000000..8d26071
--- /dev/null
+++ b/docs/Model/CallStateEnum.md
@@ -0,0 +1,8 @@
+# CallStateEnum
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+
+[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
diff --git a/docs/Model/CallTranscription.md b/docs/Model/CallTranscription.md
new file mode 100644
index 0000000..b9ad214
--- /dev/null
+++ b/docs/Model/CallTranscription.md
@@ -0,0 +1,12 @@
+# CallTranscription
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**detected_language** | [**\Bandwidth\Model\CallTranscriptionDetectedLanguageEnum**](CallTranscriptionDetectedLanguageEnum.md) | | [optional]
+**track** | [**\Bandwidth\Model\CallTranscriptionTrackEnum**](CallTranscriptionTrackEnum.md) | | [optional]
+**transcript** | **string** | The transcription itself. | [optional]
+**confidence** | **float** | How confident the transcription engine was in transcribing the associated audio (from `0` to `1`). | [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/CallTranscriptionDetectedLanguageEnum.md b/docs/Model/CallTranscriptionDetectedLanguageEnum.md
new file mode 100644
index 0000000..10a2cb7
--- /dev/null
+++ b/docs/Model/CallTranscriptionDetectedLanguageEnum.md
@@ -0,0 +1,8 @@
+# CallTranscriptionDetectedLanguageEnum
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+
+[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
diff --git a/docs/Model/CallTranscriptionMetadata.md b/docs/Model/CallTranscriptionMetadata.md
new file mode 100644
index 0000000..04ae984
--- /dev/null
+++ b/docs/Model/CallTranscriptionMetadata.md
@@ -0,0 +1,11 @@
+# CallTranscriptionMetadata
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**transcription_id** | **string** | The programmable voice API transcription ID. | [optional]
+**transcription_name** | **string** | The programmable voice API transcription name. This name could be provided by the user when creating the transcription. | [optional]
+**transcription_url** | **string** | A URL that may be used to retrieve the transcription itself. This points to the [Get Call Transcription](/apis/voice-apis/voice/#tag/Transcriptions/operation/getRealTimeTranscription) endpoint. | [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/CallTranscriptionResponse.md b/docs/Model/CallTranscriptionResponse.md
new file mode 100644
index 0000000..cf2d9f5
--- /dev/null
+++ b/docs/Model/CallTranscriptionResponse.md
@@ -0,0 +1,12 @@
+# CallTranscriptionResponse
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**account_id** | **string** | The user account associated with the call. | [optional]
+**call_id** | **string** | The call id associated with the event. | [optional]
+**transcription_id** | **string** | The programmable voice API transcription ID. | [optional]
+**tracks** | [**\Bandwidth\Model\CallTranscription[]**](CallTranscription.md) | | [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/CallTranscriptionTrackEnum.md b/docs/Model/CallTranscriptionTrackEnum.md
new file mode 100644
index 0000000..a2e7f72
--- /dev/null
+++ b/docs/Model/CallTranscriptionTrackEnum.md
@@ -0,0 +1,8 @@
+# CallTranscriptionTrackEnum
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+
+[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
diff --git a/docs/Model/Callback.md b/docs/Model/Callback.md
new file mode 100644
index 0000000..27e4783
--- /dev/null
+++ b/docs/Model/Callback.md
@@ -0,0 +1,13 @@
+# Callback
+
+This model is a `oneOf` wrapper: a value is exactly one of the member types listed below.
+It is never instantiated directly — use one of the concrete types.
+
+## oneOf
+
+- [**\Bandwidth\Model\StatusCallback**](StatusCallback.md)
+- [**\Bandwidth\Model\InboundCallback**](InboundCallback.md)
+
+The concrete type is selected by the `type` discriminator property.
+
+[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
diff --git a/docs/Model/CallbackMethodEnum.md b/docs/Model/CallbackMethodEnum.md
new file mode 100644
index 0000000..89658f4
--- /dev/null
+++ b/docs/Model/CallbackMethodEnum.md
@@ -0,0 +1,8 @@
+# CallbackMethodEnum
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+
+[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
diff --git a/docs/Model/CardWidthEnum.md b/docs/Model/CardWidthEnum.md
new file mode 100644
index 0000000..9d737ec
--- /dev/null
+++ b/docs/Model/CardWidthEnum.md
@@ -0,0 +1,8 @@
+# CardWidthEnum
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+
+[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
diff --git a/docs/Model/CodeRequest.md b/docs/Model/CodeRequest.md
new file mode 100644
index 0000000..40a0a6d
--- /dev/null
+++ b/docs/Model/CodeRequest.md
@@ -0,0 +1,14 @@
+# CodeRequest
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**to** | **string** | The phone number to send the mfa code to. |
+**from** | **string** | The application phone number, the sender of the mfa code. |
+**application_id** | **string** | The application unique ID, obtained from Bandwidth. |
+**scope** | **string** | An optional field to denote what scope or action the mfa code is addressing. If not supplied, defaults to \"2FA\". | [optional]
+**message** | **string** | The message format of the mfa code. There are three values that the system will replace \"{CODE}\", \"{NAME}\", \"{SCOPE}\". The \"{SCOPE}\" and \"{NAME} value template are optional, while \"{CODE}\" must be supplied. As the name would suggest, code will be replace with the actual mfa code. Name is replaced with the application name, configured during provisioning of mfa. The scope value is the same value sent during the call and partitioned by the server. |
+**digits** | **int** | The number of digits for your mfa code. The valid number ranges from 2 to 8, inclusively. |
+
+[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
diff --git a/docs/Model/CompletedLookupStatusEnum.md b/docs/Model/CompletedLookupStatusEnum.md
new file mode 100644
index 0000000..ea04ebf
--- /dev/null
+++ b/docs/Model/CompletedLookupStatusEnum.md
@@ -0,0 +1,8 @@
+# CompletedLookupStatusEnum
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+
+[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
diff --git a/docs/Model/Conference.md b/docs/Model/Conference.md
new file mode 100644
index 0000000..6a35def
--- /dev/null
+++ b/docs/Model/Conference.md
@@ -0,0 +1,16 @@
+# Conference
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**id** | **string** | The Bandwidth-generated conference ID. | [optional]
+**name** | **string** | The name of the conference, as specified by your application. | [optional]
+**created_time** | **\DateTime** | The time the conference was initiated, in ISO 8601 format. | [optional]
+**completed_time** | **\DateTime** | The time the conference was terminated, in ISO 8601 format. | [optional]
+**conference_event_url** | **string** | The URL to send the conference-related events. | [optional]
+**conference_event_method** | [**\Bandwidth\Model\CallbackMethodEnum**](CallbackMethodEnum.md) | | [optional]
+**tag** | **string** | The custom string attached to the conference that will be sent with callbacks. | [optional]
+**active_members** | [**\Bandwidth\Model\ConferenceMember[]**](ConferenceMember.md) | A list of active members of the conference. Omitted if this is a response to the [Get Conferences endpoint](/apis/voice#tag/Conferences/operation/listConferences). | [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/ConferenceCompletedCallback.md b/docs/Model/ConferenceCompletedCallback.md
new file mode 100644
index 0000000..60a60e8
--- /dev/null
+++ b/docs/Model/ConferenceCompletedCallback.md
@@ -0,0 +1,13 @@
+# ConferenceCompletedCallback
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**event_type** | **string** | The event type, value can be one of the following: answer, bridgeComplete, bridgeTargetComplete, conferenceCreated, conferenceRedirect, conferenceMemberJoin, conferenceMemberExit, conferenceCompleted, conferenceRecordingAvailable, disconnect, dtmf, gather, initiate, machineDetectionComplete, recordingComplete, recordingAvailable, redirect, transcriptionAvailable, transferAnswer, transferComplete, transferDisconnect. | [optional]
+**event_time** | **\DateTime** | The approximate UTC date and time when the event was generated by the Bandwidth server, in ISO 8601 format. This may not be exactly the time of event execution. | [optional]
+**conference_id** | **string** | The unique, Bandwidth-generated ID of the conference that was recorded | [optional]
+**name** | **string** | The user-specified name of the conference that was recorded | [optional]
+**tag** | **string** | (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present. | [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/ConferenceCreatedCallback.md b/docs/Model/ConferenceCreatedCallback.md
new file mode 100644
index 0000000..f54696f
--- /dev/null
+++ b/docs/Model/ConferenceCreatedCallback.md
@@ -0,0 +1,13 @@
+# ConferenceCreatedCallback
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**event_type** | **string** | The event type, value can be one of the following: answer, bridgeComplete, bridgeTargetComplete, conferenceCreated, conferenceRedirect, conferenceMemberJoin, conferenceMemberExit, conferenceCompleted, conferenceRecordingAvailable, disconnect, dtmf, gather, initiate, machineDetectionComplete, recordingComplete, recordingAvailable, redirect, transcriptionAvailable, transferAnswer, transferComplete, transferDisconnect. | [optional]
+**event_time** | **\DateTime** | The approximate UTC date and time when the event was generated by the Bandwidth server, in ISO 8601 format. This may not be exactly the time of event execution. | [optional]
+**conference_id** | **string** | The unique, Bandwidth-generated ID of the conference that was recorded | [optional]
+**name** | **string** | The user-specified name of the conference that was recorded | [optional]
+**tag** | **string** | (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present. | [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/ConferenceMember.md b/docs/Model/ConferenceMember.md
new file mode 100644
index 0000000..ad6d74f
--- /dev/null
+++ b/docs/Model/ConferenceMember.md
@@ -0,0 +1,14 @@
+# ConferenceMember
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**call_id** | **string** | The call id associated with the event. | [optional]
+**conference_id** | **string** | The unique, Bandwidth-generated ID of the conference that was recorded | [optional]
+**member_url** | **string** | A URL that may be used to retrieve information about or update the state of this conference member. This is the URL of this member's [Get Conference Member](/apis/voice-apis/voice/#tag/Conferences/operation/getConferenceMember) endpoint and [Modify Conference Member](/apis/voice-apis/voice/#tag/Conferences/operation/updateConferenceMember) endpoint. | [optional]
+**mute** | **bool** | Whether or not this member is currently muted. Members who are muted are still able to hear other participants. If used in a PUT request, updates this member's mute status. Has no effect if omitted. | [optional]
+**hold** | **bool** | Whether or not this member is currently on hold. Members who are on hold are not able to hear or speak in the conference. If used in a PUT request, updates this member's hold status. Has no effect if omitted. | [optional]
+**call_ids_to_coach** | **string[]** | If this member had a value set for `callIdsToCoach` in its [Conference](/docs/voice/bxml/conference) verb or this list was added with a previous PUT request to modify the member, this is that list of calls. If present in a PUT request, modifies the calls that this member is coaching. Has no effect if omitted. See the documentation for the [Conference](/docs/voice/bxml/conference) verb for more details about coaching. Note that this will not add the matching calls to the conference; each call must individually execute a Conference verb to join. | [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/ConferenceMemberExitCallback.md b/docs/Model/ConferenceMemberExitCallback.md
new file mode 100644
index 0000000..837a8e0
--- /dev/null
+++ b/docs/Model/ConferenceMemberExitCallback.md
@@ -0,0 +1,16 @@
+# ConferenceMemberExitCallback
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**event_type** | **string** | The event type, value can be one of the following: answer, bridgeComplete, bridgeTargetComplete, conferenceCreated, conferenceRedirect, conferenceMemberJoin, conferenceMemberExit, conferenceCompleted, conferenceRecordingAvailable, disconnect, dtmf, gather, initiate, machineDetectionComplete, recordingComplete, recordingAvailable, redirect, transcriptionAvailable, transferAnswer, transferComplete, transferDisconnect. | [optional]
+**event_time** | **\DateTime** | The approximate UTC date and time when the event was generated by the Bandwidth server, in ISO 8601 format. This may not be exactly the time of event execution. | [optional]
+**conference_id** | **string** | The unique, Bandwidth-generated ID of the conference that was recorded | [optional]
+**name** | **string** | The user-specified name of the conference that was recorded | [optional]
+**from** | **string** | The provided identifier of the caller. Must be a phone number in E.164 format (e.g. +15555555555). | [optional]
+**to** | **string** | The phone number that received the call, in E.164 format (e.g. +15555555555). | [optional]
+**call_id** | **string** | The call id associated with the event. | [optional]
+**tag** | **string** | (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present. | [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/ConferenceMemberJoinCallback.md b/docs/Model/ConferenceMemberJoinCallback.md
new file mode 100644
index 0000000..f47aea1
--- /dev/null
+++ b/docs/Model/ConferenceMemberJoinCallback.md
@@ -0,0 +1,16 @@
+# ConferenceMemberJoinCallback
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**event_type** | **string** | The event type, value can be one of the following: answer, bridgeComplete, bridgeTargetComplete, conferenceCreated, conferenceRedirect, conferenceMemberJoin, conferenceMemberExit, conferenceCompleted, conferenceRecordingAvailable, disconnect, dtmf, gather, initiate, machineDetectionComplete, recordingComplete, recordingAvailable, redirect, transcriptionAvailable, transferAnswer, transferComplete, transferDisconnect. | [optional]
+**event_time** | **\DateTime** | The approximate UTC date and time when the event was generated by the Bandwidth server, in ISO 8601 format. This may not be exactly the time of event execution. | [optional]
+**conference_id** | **string** | The unique, Bandwidth-generated ID of the conference that was recorded | [optional]
+**name** | **string** | The user-specified name of the conference that was recorded | [optional]
+**from** | **string** | The provided identifier of the caller. Must be a phone number in E.164 format (e.g. +15555555555). | [optional]
+**to** | **string** | The phone number that received the call, in E.164 format (e.g. +15555555555). | [optional]
+**call_id** | **string** | The call id associated with the event. | [optional]
+**tag** | **string** | (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present. | [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/ConferenceRecordingAvailableCallback.md b/docs/Model/ConferenceRecordingAvailableCallback.md
new file mode 100644
index 0000000..23a8280
--- /dev/null
+++ b/docs/Model/ConferenceRecordingAvailableCallback.md
@@ -0,0 +1,22 @@
+# ConferenceRecordingAvailableCallback
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**event_type** | **string** | The event type, value can be one of the following: answer, bridgeComplete, bridgeTargetComplete, conferenceCreated, conferenceRedirect, conferenceMemberJoin, conferenceMemberExit, conferenceCompleted, conferenceRecordingAvailable, disconnect, dtmf, gather, initiate, machineDetectionComplete, recordingComplete, recordingAvailable, redirect, transcriptionAvailable, transferAnswer, transferComplete, transferDisconnect. | [optional]
+**event_time** | **\DateTime** | The approximate UTC date and time when the event was generated by the Bandwidth server, in ISO 8601 format. This may not be exactly the time of event execution. | [optional]
+**conference_id** | **string** | The unique, Bandwidth-generated ID of the conference that was recorded | [optional]
+**name** | **string** | The user-specified name of the conference that was recorded | [optional]
+**account_id** | **string** | The user account associated with the call. | [optional]
+**recording_id** | **string** | The unique ID of this recording | [optional]
+**channels** | **int** | Always `1` for conference recordings; multi-channel recordings are not supported on conferences. | [optional]
+**start_time** | **\DateTime** | Time the call was started, in ISO 8601 format. | [optional]
+**end_time** | **\DateTime** | The time that the recording ended in ISO-8601 format | [optional]
+**duration** | **string** | The duration of the recording in ISO-8601 format | [optional]
+**file_format** | [**\Bandwidth\Model\FileFormatEnum**](FileFormatEnum.md) | | [optional]
+**media_url** | **string** | The URL that can be used to download the recording. Only present if the recording is finished and may be downloaded. | [optional]
+**tag** | **string** | (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present. | [optional]
+**status** | **string** | The current status of the process. For recording, current possible values are 'processing', 'partial', 'complete', 'deleted', and 'error'. For transcriptions, current possible values are 'none', 'processing', 'available', 'error', 'timeout', 'file-size-too-big', and 'file-size-too-small'. Additional states may be added in the future, so your application must be tolerant of unknown values. | [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/ConferenceRecordingMetadata.md b/docs/Model/ConferenceRecordingMetadata.md
new file mode 100644
index 0000000..257aa51
--- /dev/null
+++ b/docs/Model/ConferenceRecordingMetadata.md
@@ -0,0 +1,20 @@
+# ConferenceRecordingMetadata
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**account_id** | **string** | The user account associated with the call. | [optional]
+**conference_id** | **string** | The unique, Bandwidth-generated ID of the conference that was recorded | [optional]
+**name** | **string** | The user-specified name of the conference that was recorded | [optional]
+**recording_id** | **string** | The unique ID of this recording | [optional]
+**duration** | **string** | The duration of the recording in ISO-8601 format | [optional]
+**channels** | **int** | Always `1` for conference recordings; multi-channel recordings are not supported on conferences. | [optional]
+**start_time** | **\DateTime** | Time the call was started, in ISO 8601 format. | [optional]
+**end_time** | **\DateTime** | The time that the recording ended in ISO-8601 format | [optional]
+**file_format** | [**\Bandwidth\Model\FileFormatEnum**](FileFormatEnum.md) | | [optional]
+**status** | **string** | The current status of the process. For recording, current possible values are 'processing', 'partial', 'complete', 'deleted', and 'error'. For transcriptions, current possible values are 'none', 'processing', 'available', 'error', 'timeout', 'file-size-too-big', and 'file-size-too-small'. Additional states may be added in the future, so your application must be tolerant of unknown values. | [optional]
+**media_url** | **string** | The URL that can be used to download the recording. Only present if the recording is finished and may be downloaded. | [optional]
+**recording_name** | **string** | A name to identify this recording. | [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/ConferenceRedirectCallback.md b/docs/Model/ConferenceRedirectCallback.md
new file mode 100644
index 0000000..d1bd898
--- /dev/null
+++ b/docs/Model/ConferenceRedirectCallback.md
@@ -0,0 +1,13 @@
+# ConferenceRedirectCallback
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**event_type** | **string** | The event type, value can be one of the following: answer, bridgeComplete, bridgeTargetComplete, conferenceCreated, conferenceRedirect, conferenceMemberJoin, conferenceMemberExit, conferenceCompleted, conferenceRecordingAvailable, disconnect, dtmf, gather, initiate, machineDetectionComplete, recordingComplete, recordingAvailable, redirect, transcriptionAvailable, transferAnswer, transferComplete, transferDisconnect. | [optional]
+**event_time** | **\DateTime** | The approximate UTC date and time when the event was generated by the Bandwidth server, in ISO 8601 format. This may not be exactly the time of event execution. | [optional]
+**conference_id** | **string** | The unique, Bandwidth-generated ID of the conference that was recorded | [optional]
+**name** | **string** | The user-specified name of the conference that was recorded | [optional]
+**tag** | **string** | (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present. | [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/ConferenceStateEnum.md b/docs/Model/ConferenceStateEnum.md
new file mode 100644
index 0000000..e61483b
--- /dev/null
+++ b/docs/Model/ConferenceStateEnum.md
@@ -0,0 +1,8 @@
+# ConferenceStateEnum
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+
+[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
diff --git a/docs/Model/Contact.md b/docs/Model/Contact.md
new file mode 100644
index 0000000..e18b6e6
--- /dev/null
+++ b/docs/Model/Contact.md
@@ -0,0 +1,12 @@
+# Contact
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**first_name** | **string** | The first name of the business contact using the toll-free number. |
+**last_name** | **string** | The last name of the business contact using the toll-free number. |
+**email** | **string** | |
+**phone_number** | **string** | Contact telephone number |
+
+[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
diff --git a/docs/Model/CreateAsyncBulkLookupResponse.md b/docs/Model/CreateAsyncBulkLookupResponse.md
new file mode 100644
index 0000000..1f8241e
--- /dev/null
+++ b/docs/Model/CreateAsyncBulkLookupResponse.md
@@ -0,0 +1,11 @@
+# CreateAsyncBulkLookupResponse
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**links** | [**\Bandwidth\Model\LinkSchema[]**](LinkSchema.md) | Links for pagination (if applicable) | [optional]
+**data** | [**\Bandwidth\Model\CreateAsyncBulkLookupResponseData**](CreateAsyncBulkLookupResponseData.md) | | [optional]
+**errors** | [**\Bandwidth\Model\LookupErrorSchema[]**](LookupErrorSchema.md) | | [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/CreateAsyncBulkLookupResponseData.md b/docs/Model/CreateAsyncBulkLookupResponseData.md
new file mode 100644
index 0000000..257952a
--- /dev/null
+++ b/docs/Model/CreateAsyncBulkLookupResponseData.md
@@ -0,0 +1,10 @@
+# CreateAsyncBulkLookupResponseData
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**request_id** | **string** | The phone number lookup request ID from Bandwidth. | [optional]
+**status** | [**\Bandwidth\Model\InProgressLookupStatusEnum**](InProgressLookupStatusEnum.md) | | [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/CreateCall.md b/docs/Model/CreateCall.md
new file mode 100644
index 0000000..08fc238
--- /dev/null
+++ b/docs/Model/CreateCall.md
@@ -0,0 +1,29 @@
+# CreateCall
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**to** | **string** | The destination to call (must be an E.164 formatted number (e.g. `+15555551212`) or a SIP URI (e.g. `sip:user@server.example`)). |
+**from** | **string** | A Bandwidth phone number on your account the call should come from (must be in E.164 format, like `+15555551212`) even if `privacy` is set to true. |
+**privacy** | **bool** | Hide the calling number. The `displayName` field can be used to customize the displayed name. | [optional]
+**display_name** | **string** | The caller display name to use when the call is created. May not exceed 256 characters nor contain control characters such as new lines. If `privacy` is true, only the following values are valid: `Restricted`, `Anonymous`, `Private`, or `Unavailable`. | [optional]
+**uui** | **string** | A comma-separated list of 'User-To-User' headers to be sent in the INVITE when calling a SIP URI. Each value must end with an 'encoding' parameter as described in <a href='https://tools.ietf.org/html/rfc7433'>RFC 7433</a>. Only 'jwt', 'base64' and 'hex' encodings are allowed. The entire value cannot exceed 350 characters, including parameters and separators. | [optional]
+**application_id** | **string** | The id of the application associated with the `from` number. |
+**answer_url** | **string** | The full URL to send the <a href='/docs/voice/webhooks/answer'>Answer</a> event to when the called party answers. This endpoint should return the first <a href='/docs/voice/bxml'>BXML document</a> to be executed in the call. Must use `https` if specifying `username` and `password`. |
+**answer_method** | [**\Bandwidth\Model\CallbackMethodEnum**](CallbackMethodEnum.md) | | [optional]
+**username** | **string** | Basic auth username. | [optional]
+**password** | **string** | Basic auth password. | [optional]
+**answer_fallback_url** | **string** | A fallback url which, if provided, will be used to retry the `answer` webhook delivery in case `answerUrl` fails to respond Must use `https` if specifying `fallbackUsername` and `fallbackPassword`. | [optional]
+**answer_fallback_method** | [**\Bandwidth\Model\CallbackMethodEnum**](CallbackMethodEnum.md) | | [optional]
+**fallback_username** | **string** | Basic auth username. | [optional]
+**fallback_password** | **string** | Basic auth password. | [optional]
+**disconnect_url** | **string** | The URL to send the <a href='/docs/voice/webhooks/disconnect'>Disconnect</a> event to when the call ends. This event does not expect a BXML response. | [optional]
+**disconnect_method** | [**\Bandwidth\Model\CallbackMethodEnum**](CallbackMethodEnum.md) | | [optional]
+**call_timeout** | **float** | The timeout (in seconds) for the callee to answer the call after it starts ringing. If the call does not start ringing within 30s, the call will be cancelled regardless of this value. Can be any numeric value (including decimals) between 1 and 300. | [optional] [default to 30]
+**callback_timeout** | **float** | This is the timeout (in seconds) to use when delivering webhooks for the call. Can be any numeric value (including decimals) between 1 and 25. | [optional] [default to 15]
+**machine_detection** | [**\Bandwidth\Model\MachineDetectionConfiguration**](MachineDetectionConfiguration.md) | | [optional]
+**priority** | **int** | The priority of this call over other calls from your account. For example, if during a call your application needs to place a new call and bridge it with the current call, you might want to create the call with priority 1 so that it will be the next call picked off your queue, ahead of other less time sensitive calls. A lower value means higher priority, so a priority 1 call takes precedence over a priority 2 call. | [optional] [default to 5]
+**tag** | **string** | A custom string that will be sent with all webhooks for this call unless overwritten by a future <a href='/docs/voice/bxml/tag'>`<Tag>`</a> verb or `tag` attribute on another verb, or cleared. May be cleared by setting `tag=\"\"` Max length 4096 characters. | [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/CreateCallResponse.md b/docs/Model/CreateCallResponse.md
new file mode 100644
index 0000000..9d8b465
--- /dev/null
+++ b/docs/Model/CreateCallResponse.md
@@ -0,0 +1,29 @@
+# CreateCallResponse
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**application_id** | **string** | The id of the application associated with the `from` number. |
+**account_id** | **string** | The bandwidth account ID associated with the call. |
+**call_id** | **string** | Programmable Voice API Call ID. |
+**to** | **string** | Recipient of the outgoing call. |
+**from** | **string** | Phone number that created the outbound call. |
+**enqueued_time** | **\DateTime** | The time at which the call was accepted into the queue. | [optional]
+**call_url** | **string** | The URL to update this call's state. |
+**call_timeout** | **float** | The timeout (in seconds) for the callee to answer the call after it starts ringing. | [optional]
+**callback_timeout** | **float** | This is the timeout (in seconds) to use when delivering webhooks for the call. | [optional]
+**tag** | **string** | Custom tag value. | [optional]
+**answer_method** | [**\Bandwidth\Model\CallbackMethodEnum**](CallbackMethodEnum.md) | |
+**answer_url** | **string** | URL to deliver the `answer` event webhook. |
+**answer_fallback_method** | [**\Bandwidth\Model\CallbackMethodEnum**](CallbackMethodEnum.md) | | [optional]
+**answer_fallback_url** | **string** | Fallback URL to deliver the `answer` event webhook. | [optional]
+**disconnect_method** | [**\Bandwidth\Model\CallbackMethodEnum**](CallbackMethodEnum.md) | |
+**disconnect_url** | **string** | URL to deliver the `disconnect` event webhook. | [optional]
+**username** | **string** | Basic auth username. | [optional]
+**password** | **string** | Basic auth password. | [optional]
+**fallback_username** | **string** | Basic auth username. | [optional]
+**fallback_password** | **string** | Basic auth password. | [optional]
+**priority** | **int** | The priority of this call over other calls from your account. | [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/CreateEndpointRequestBase.md b/docs/Model/CreateEndpointRequestBase.md
new file mode 100644
index 0000000..30f9780
--- /dev/null
+++ b/docs/Model/CreateEndpointRequestBase.md
@@ -0,0 +1,13 @@
+# CreateEndpointRequestBase
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**type** | [**\Bandwidth\Model\EndpointTypeEnum**](EndpointTypeEnum.md) | |
+**direction** | [**\Bandwidth\Model\EndpointDirectionEnum**](EndpointDirectionEnum.md) | |
+**event_callback_url** | **string** | The URL to send event callbacks to. | [optional]
+**event_fallback_url** | **string** | The URL to send event fallbacks to. | [optional]
+**tag** | **string** | A tag for the endpoint. | [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/CreateEndpointResponse.md b/docs/Model/CreateEndpointResponse.md
new file mode 100644
index 0000000..59464de
--- /dev/null
+++ b/docs/Model/CreateEndpointResponse.md
@@ -0,0 +1,11 @@
+# CreateEndpointResponse
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**links** | [**\Bandwidth\Model\BrtcLink[]**](BrtcLink.md) | |
+**data** | [**\Bandwidth\Model\CreateEndpointResponseData**](CreateEndpointResponseData.md) | |
+**errors** | [**\Bandwidth\Model\BrtcError[]**](BrtcError.md) | |
+
+[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
diff --git a/docs/Model/CreateEndpointResponseData.md b/docs/Model/CreateEndpointResponseData.md
new file mode 100644
index 0000000..37f3745
--- /dev/null
+++ b/docs/Model/CreateEndpointResponseData.md
@@ -0,0 +1,16 @@
+# CreateEndpointResponseData
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**endpoint_id** | **string** | The unique ID of the endpoint. |
+**type** | [**\Bandwidth\Model\EndpointTypeEnum**](EndpointTypeEnum.md) | |
+**status** | [**\Bandwidth\Model\EndpointStatusEnum**](EndpointStatusEnum.md) | |
+**creation_timestamp** | **\DateTime** | The time the endpoint was created. In ISO-8601 format. |
+**expiration_timestamp** | **\DateTime** | The time the endpoint token will expire. In ISO-8601 format. Tokens last 24 hours. |
+**tag** | **string** | A tag for the endpoint. | [optional]
+**devices** | [**\Bandwidth\Model\Device[]**](Device.md) | | [optional]
+**token** | **string** | The json web token specific to the endpoint. Used to authenticate the client with the media gateway. |
+
+[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
diff --git a/docs/Model/CreateMessageRequestError.md b/docs/Model/CreateMessageRequestError.md
new file mode 100644
index 0000000..f67b8a2
--- /dev/null
+++ b/docs/Model/CreateMessageRequestError.md
@@ -0,0 +1,11 @@
+# CreateMessageRequestError
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**type** | **string** | |
+**description** | **string** | |
+**field_errors** | [**\Bandwidth\Model\FieldError[]**](FieldError.md) | | [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/CreateMultiChannelMessageResponse.md b/docs/Model/CreateMultiChannelMessageResponse.md
new file mode 100644
index 0000000..cfcee27
--- /dev/null
+++ b/docs/Model/CreateMultiChannelMessageResponse.md
@@ -0,0 +1,11 @@
+# CreateMultiChannelMessageResponse
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**links** | [**\Bandwidth\Model\Link[]**](Link.md) | | [optional]
+**data** | [**\Bandwidth\Model\MultiChannelMessageResponseData**](MultiChannelMessageResponseData.md) | | [optional]
+**errors** | [**\Bandwidth\Model\ErrorObject[]**](ErrorObject.md) | | [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/CreateSyncLookupResponse.md b/docs/Model/CreateSyncLookupResponse.md
new file mode 100644
index 0000000..96ec124
--- /dev/null
+++ b/docs/Model/CreateSyncLookupResponse.md
@@ -0,0 +1,11 @@
+# CreateSyncLookupResponse
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**links** | [**\Bandwidth\Model\LinkSchema[]**](LinkSchema.md) | | [optional]
+**data** | [**\Bandwidth\Model\CreateSyncLookupResponseData**](CreateSyncLookupResponseData.md) | | [optional]
+**errors** | [**\Bandwidth\Model\LookupErrorSchema[]**](LookupErrorSchema.md) | | [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/CreateSyncLookupResponseData.md b/docs/Model/CreateSyncLookupResponseData.md
new file mode 100644
index 0000000..c7be58f
--- /dev/null
+++ b/docs/Model/CreateSyncLookupResponseData.md
@@ -0,0 +1,11 @@
+# CreateSyncLookupResponseData
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**request_id** | **string** | The phone number lookup request ID from Bandwidth. | [optional]
+**status** | [**\Bandwidth\Model\CompletedLookupStatusEnum**](CompletedLookupStatusEnum.md) | | [optional]
+**results** | [**\Bandwidth\Model\LookupResult[]**](LookupResult.md) | The carrier information results for the specified telephone numbers. | [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/CreateWebRtcConnectionRequest.md b/docs/Model/CreateWebRtcConnectionRequest.md
new file mode 100644
index 0000000..0394e4f
--- /dev/null
+++ b/docs/Model/CreateWebRtcConnectionRequest.md
@@ -0,0 +1,14 @@
+# CreateWebRtcConnectionRequest
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**type** | [**\Bandwidth\Model\EndpointTypeEnum**](EndpointTypeEnum.md) | |
+**direction** | [**\Bandwidth\Model\EndpointDirectionEnum**](EndpointDirectionEnum.md) | |
+**event_callback_url** | **string** | The URL to send event callbacks to. | [optional]
+**event_fallback_url** | **string** | The URL to send event fallbacks to. | [optional]
+**tag** | **string** | A tag for the endpoint. | [optional]
+**connection_metadata** | **object** | | [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/DeactivationEventEnum.md b/docs/Model/DeactivationEventEnum.md
new file mode 100644
index 0000000..c8bdf82
--- /dev/null
+++ b/docs/Model/DeactivationEventEnum.md
@@ -0,0 +1,8 @@
+# DeactivationEventEnum
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+
+[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
diff --git a/docs/Model/Device.md b/docs/Model/Device.md
new file mode 100644
index 0000000..48373dd
--- /dev/null
+++ b/docs/Model/Device.md
@@ -0,0 +1,12 @@
+# Device
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**device_id** | **string** | The unique ID of the device. |
+**device_name** | **string** | The name of the device. | [optional]
+**status** | [**\Bandwidth\Model\DeviceStatusEnum**](DeviceStatusEnum.md) | |
+**creation_timestamp** | **\DateTime** | The time the device was created. In ISO-8601 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/DeviceStatusEnum.md b/docs/Model/DeviceStatusEnum.md
new file mode 100644
index 0000000..7bc751c
--- /dev/null
+++ b/docs/Model/DeviceStatusEnum.md
@@ -0,0 +1,8 @@
+# DeviceStatusEnum
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+
+[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
diff --git a/docs/Model/DisconnectCallback.md b/docs/Model/DisconnectCallback.md
new file mode 100644
index 0000000..8cf3fc8
--- /dev/null
+++ b/docs/Model/DisconnectCallback.md
@@ -0,0 +1,25 @@
+# DisconnectCallback
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**event_type** | **string** | The event type, value can be one of the following: answer, bridgeComplete, bridgeTargetComplete, conferenceCreated, conferenceRedirect, conferenceMemberJoin, conferenceMemberExit, conferenceCompleted, conferenceRecordingAvailable, disconnect, dtmf, gather, initiate, machineDetectionComplete, recordingComplete, recordingAvailable, redirect, transcriptionAvailable, transferAnswer, transferComplete, transferDisconnect. | [optional]
+**event_time** | **\DateTime** | The approximate UTC date and time when the event was generated by the Bandwidth server, in ISO 8601 format. This may not be exactly the time of event execution. | [optional]
+**account_id** | **string** | The user account associated with the call. | [optional]
+**application_id** | **string** | The id of the application associated with the call. | [optional]
+**from** | **string** | The provided identifier of the caller. Must be a phone number in E.164 format (e.g. +15555555555). | [optional]
+**to** | **string** | The phone number that received the call, in E.164 format (e.g. +15555555555). | [optional]
+**call_id** | **string** | The call id associated with the event. | [optional]
+**direction** | [**\Bandwidth\Model\CallDirectionEnum**](CallDirectionEnum.md) | | [optional]
+**call_url** | **string** | The URL of the call associated with the event. | [optional]
+**enqueued_time** | **\DateTime** | (optional) If call queueing is enabled and this is an outbound call, time the call was queued, in ISO 8601 format. | [optional]
+**start_time** | **\DateTime** | Time the call was started, in ISO 8601 format. | [optional]
+**answer_time** | **\DateTime** | Time the call was answered, in ISO 8601 format. | [optional]
+**end_time** | **\DateTime** | The time that the recording ended in ISO-8601 format | [optional]
+**cause** | **string** | Reason the call failed - hangup, busy, timeout, cancel, rejected, callback-error, invalid-bxml, application-error, account-limit, node-capacity-exceeded, error, or unknown. | [optional]
+**error_message** | **string** | Text explaining the reason that caused the call to fail in case of errors. | [optional]
+**error_id** | **string** | Bandwidth's internal id that references the error event. | [optional]
+**tag** | **string** | (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present. | [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/Diversion.md b/docs/Model/Diversion.md
new file mode 100644
index 0000000..7bb2d6c
--- /dev/null
+++ b/docs/Model/Diversion.md
@@ -0,0 +1,15 @@
+# Diversion
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**reason** | **string** | The reason for the diversion. Common values: unknown, user-busy, no-answer, unavailable, unconditional, time-of-day, do-not-disturb, deflection, follow-me, out-of-service, away. | [optional]
+**privacy** | **string** | off or full | [optional]
+**screen** | **string** | No if the number was provided by the user, yes if the number was provided by the network | [optional]
+**counter** | **string** | The number of diversions that have occurred | [optional]
+**limit** | **string** | The maximum number of diversions allowed for this session | [optional]
+**unknown** | **string** | The normal list of values is not exhaustive. Your application must be tolerant of unlisted keys and unlisted values of those keys. | [optional]
+**orig_to** | **string** | Always present. Indicates the last telephone number that the call was diverted from. | [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/DtmfCallback.md b/docs/Model/DtmfCallback.md
new file mode 100644
index 0000000..a01d9d0
--- /dev/null
+++ b/docs/Model/DtmfCallback.md
@@ -0,0 +1,25 @@
+# DtmfCallback
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**event_type** | **string** | The event type, value can be one of the following: answer, bridgeComplete, bridgeTargetComplete, conferenceCreated, conferenceRedirect, conferenceMemberJoin, conferenceMemberExit, conferenceCompleted, conferenceRecordingAvailable, disconnect, dtmf, gather, initiate, machineDetectionComplete, recordingComplete, recordingAvailable, redirect, transcriptionAvailable, transferAnswer, transferComplete, transferDisconnect. | [optional]
+**event_time** | **\DateTime** | The approximate UTC date and time when the event was generated by the Bandwidth server, in ISO 8601 format. This may not be exactly the time of event execution. | [optional]
+**account_id** | **string** | The user account associated with the call. | [optional]
+**application_id** | **string** | The id of the application associated with the call. | [optional]
+**from** | **string** | The provided identifier of the caller. Must be a phone number in E.164 format (e.g. +15555555555). | [optional]
+**to** | **string** | The phone number that received the call, in E.164 format (e.g. +15555555555). | [optional]
+**call_id** | **string** | The call id associated with the event. | [optional]
+**direction** | [**\Bandwidth\Model\CallDirectionEnum**](CallDirectionEnum.md) | | [optional]
+**digit** | **string** | The digit collected in the call. | [optional]
+**call_url** | **string** | The URL of the call associated with the event. | [optional]
+**enqueued_time** | **\DateTime** | (optional) If call queueing is enabled and this is an outbound call, time the call was queued, in ISO 8601 format. | [optional]
+**start_time** | **\DateTime** | Time the call was started, in ISO 8601 format. | [optional]
+**answer_time** | **\DateTime** | Time the call was answered, in ISO 8601 format. | [optional]
+**parent_call_id** | **string** | (optional) If the event is related to the B leg of a <Transfer>, the call id of the original call leg that executed the <Transfer>. Otherwise, this field will not be present. | [optional]
+**transfer_caller_id** | **string** | The phone number used as the from field of the B-leg call, in E.164 format (e.g. +15555555555). | [optional]
+**transfer_to** | **string** | The phone number used as the to field of the B-leg call, in E.164 format (e.g. +15555555555). | [optional]
+**tag** | **string** | (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present. | [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/Endpoint.md b/docs/Model/Endpoint.md
new file mode 100644
index 0000000..708d4ff
--- /dev/null
+++ b/docs/Model/Endpoint.md
@@ -0,0 +1,15 @@
+# Endpoint
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**endpoint_id** | **string** | The unique ID of the endpoint. |
+**type** | [**\Bandwidth\Model\EndpointTypeEnum**](EndpointTypeEnum.md) | |
+**status** | [**\Bandwidth\Model\EndpointStatusEnum**](EndpointStatusEnum.md) | |
+**creation_timestamp** | **\DateTime** | The time the endpoint was created. In ISO-8601 format. |
+**expiration_timestamp** | **\DateTime** | The time the endpoint token will expire. In ISO-8601 format. Tokens last 24 hours. |
+**tag** | **string** | A tag for the endpoint. | [optional]
+**devices** | [**\Bandwidth\Model\Device[]**](Device.md) | | [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/EndpointDirectionEnum.md b/docs/Model/EndpointDirectionEnum.md
new file mode 100644
index 0000000..41e4d0f
--- /dev/null
+++ b/docs/Model/EndpointDirectionEnum.md
@@ -0,0 +1,8 @@
+# EndpointDirectionEnum
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+
+[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
diff --git a/docs/Model/EndpointEvent.md b/docs/Model/EndpointEvent.md
new file mode 100644
index 0000000..efe57fd
--- /dev/null
+++ b/docs/Model/EndpointEvent.md
@@ -0,0 +1,17 @@
+# EndpointEvent
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**endpoint_id** | **string** | The unique ID of the endpoint. |
+**type** | [**\Bandwidth\Model\EndpointTypeEnum**](EndpointTypeEnum.md) | |
+**status** | [**\Bandwidth\Model\EndpointStatusEnum**](EndpointStatusEnum.md) | |
+**creation_timestamp** | **\DateTime** | The time the endpoint was created. In ISO-8601 format. |
+**expiration_timestamp** | **\DateTime** | The time the endpoint token will expire. In ISO-8601 format. Tokens last 24 hours. |
+**tag** | **string** | A tag for the endpoint. | [optional]
+**event_time** | **\DateTime** | The time the event occurred. In ISO-8601 format. |
+**event_type** | [**\Bandwidth\Model\EndpointEventTypeEnum**](EndpointEventTypeEnum.md) | |
+**device** | [**\Bandwidth\Model\Device**](Device.md) | | [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/EndpointEventTypeEnum.md b/docs/Model/EndpointEventTypeEnum.md
new file mode 100644
index 0000000..da95b81
--- /dev/null
+++ b/docs/Model/EndpointEventTypeEnum.md
@@ -0,0 +1,8 @@
+# EndpointEventTypeEnum
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+
+[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
diff --git a/docs/Model/EndpointResponse.md b/docs/Model/EndpointResponse.md
new file mode 100644
index 0000000..f0bc49d
--- /dev/null
+++ b/docs/Model/EndpointResponse.md
@@ -0,0 +1,11 @@
+# EndpointResponse
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**links** | [**\Bandwidth\Model\BrtcLink[]**](BrtcLink.md) | |
+**data** | [**\Bandwidth\Model\Endpoint**](Endpoint.md) | |
+**errors** | [**\Bandwidth\Model\BrtcError[]**](BrtcError.md) | |
+
+[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
diff --git a/docs/Model/EndpointStatusEnum.md b/docs/Model/EndpointStatusEnum.md
new file mode 100644
index 0000000..c854291
--- /dev/null
+++ b/docs/Model/EndpointStatusEnum.md
@@ -0,0 +1,8 @@
+# EndpointStatusEnum
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+
+[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
diff --git a/docs/Model/EndpointTypeEnum.md b/docs/Model/EndpointTypeEnum.md
new file mode 100644
index 0000000..f6014f6
--- /dev/null
+++ b/docs/Model/EndpointTypeEnum.md
@@ -0,0 +1,8 @@
+# EndpointTypeEnum
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+
+[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
diff --git a/docs/Model/Endpoints.md b/docs/Model/Endpoints.md
new file mode 100644
index 0000000..4140446
--- /dev/null
+++ b/docs/Model/Endpoints.md
@@ -0,0 +1,14 @@
+# Endpoints
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**endpoint_id** | **string** | The unique ID of the endpoint. |
+**type** | [**\Bandwidth\Model\EndpointTypeEnum**](EndpointTypeEnum.md) | |
+**status** | [**\Bandwidth\Model\EndpointStatusEnum**](EndpointStatusEnum.md) | |
+**creation_timestamp** | **\DateTime** | The time the endpoint was created. In ISO-8601 format. |
+**expiration_timestamp** | **\DateTime** | The time the endpoint token will expire. In ISO-8601 format. Tokens last 24 hours. |
+**tag** | **string** | A tag for the endpoint. | [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/ErrorObject.md b/docs/Model/ErrorObject.md
new file mode 100644
index 0000000..6a2f6ad
--- /dev/null
+++ b/docs/Model/ErrorObject.md
@@ -0,0 +1,11 @@
+# ErrorObject
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**type** | **string** | A concise summary of the error used for categorization. |
+**description** | **string** | A detailed explanation of the error. |
+**source** | [**\Bandwidth\Model\ErrorSource**](ErrorSource.md) | |
+
+[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
diff --git a/docs/Model/ErrorSource.md b/docs/Model/ErrorSource.md
new file mode 100644
index 0000000..6450d7e
--- /dev/null
+++ b/docs/Model/ErrorSource.md
@@ -0,0 +1,12 @@
+# ErrorSource
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**parameter** | **string** | The relevant URI query parameter causing the error | [optional]
+**field** | **string** | The request body field that led to the error | [optional]
+**header** | **string** | The header field that contributed to the error | [optional]
+**reference** | **string** | A resource ID or path linked to the error | [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/FailureWebhook.md b/docs/Model/FailureWebhook.md
new file mode 100644
index 0000000..57ff20f
--- /dev/null
+++ b/docs/Model/FailureWebhook.md
@@ -0,0 +1,14 @@
+# FailureWebhook
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**account_id** | **string** | User's account ID. | [optional]
+**phone_number** | **string** | Toll-free telephone number in E.164 format. | [optional]
+**error_code** | **string** | An error code indicating what error was encountered. This code can be interpreted as an HTTP status code in regards to the error that was encountered. | [optional]
+**error_message** | **string** | A description of the error that was encountered. | [optional]
+**errors** | **string[]** | Details of the errors that were encountered when processing the request. | [optional]
+**internal_ticket_number** | **string** | Unique identifier (UUID) generated by Bandwidth to assist in tracking the verification status of a toll-free number. | [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/FieldError.md b/docs/Model/FieldError.md
new file mode 100644
index 0000000..9bb021f
--- /dev/null
+++ b/docs/Model/FieldError.md
@@ -0,0 +1,10 @@
+# FieldError
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**field_name** | **string** | The name of the field that contains the error | [optional]
+**description** | **string** | The error associated with the field | [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/FileFormatEnum.md b/docs/Model/FileFormatEnum.md
new file mode 100644
index 0000000..3bfc575
--- /dev/null
+++ b/docs/Model/FileFormatEnum.md
@@ -0,0 +1,8 @@
+# FileFormatEnum
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+
+[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
diff --git a/docs/Model/GatherCallback.md b/docs/Model/GatherCallback.md
new file mode 100644
index 0000000..681db30
--- /dev/null
+++ b/docs/Model/GatherCallback.md
@@ -0,0 +1,26 @@
+# GatherCallback
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**event_type** | **string** | The event type, value can be one of the following: answer, bridgeComplete, bridgeTargetComplete, conferenceCreated, conferenceRedirect, conferenceMemberJoin, conferenceMemberExit, conferenceCompleted, conferenceRecordingAvailable, disconnect, dtmf, gather, initiate, machineDetectionComplete, recordingComplete, recordingAvailable, redirect, transcriptionAvailable, transferAnswer, transferComplete, transferDisconnect. | [optional]
+**event_time** | **\DateTime** | The approximate UTC date and time when the event was generated by the Bandwidth server, in ISO 8601 format. This may not be exactly the time of event execution. | [optional]
+**account_id** | **string** | The user account associated with the call. | [optional]
+**application_id** | **string** | The id of the application associated with the call. | [optional]
+**from** | **string** | The provided identifier of the caller. Must be a phone number in E.164 format (e.g. +15555555555). | [optional]
+**to** | **string** | The phone number that received the call, in E.164 format (e.g. +15555555555). | [optional]
+**direction** | [**\Bandwidth\Model\CallDirectionEnum**](CallDirectionEnum.md) | | [optional]
+**call_id** | **string** | The call id associated with the event. | [optional]
+**digits** | **string** | (optional) The digits, letters, and/or symbols entered by the user. The string is empty if a timeout occurred before any buttons were pressed. | [optional]
+**call_url** | **string** | The URL of the call associated with the event. | [optional]
+**enqueued_time** | **\DateTime** | (optional) If call queueing is enabled and this is an outbound call, time the call was queued, in ISO 8601 format. | [optional]
+**start_time** | **\DateTime** | Time the call was started, in ISO 8601 format. | [optional]
+**answer_time** | **\DateTime** | Time the call was answered, in ISO 8601 format. | [optional]
+**parent_call_id** | **string** | (optional) If the event is related to the B leg of a <Transfer>, the call id of the original call leg that executed the <Transfer>. Otherwise, this field will not be present. | [optional]
+**terminating_digit** | **string** | (optional) The digit the user pressed to end the gather. Empty string value if no terminating digit was pressed. | [optional]
+**transfer_caller_id** | **string** | The phone number used as the from field of the B-leg call, in E.164 format (e.g. +15555555555). | [optional]
+**transfer_to** | **string** | The phone number used as the to field of the B-leg call, in E.164 format (e.g. +15555555555). | [optional]
+**tag** | **string** | (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present. | [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/GetAsyncBulkLookupResponse.md b/docs/Model/GetAsyncBulkLookupResponse.md
new file mode 100644
index 0000000..d9e45a6
--- /dev/null
+++ b/docs/Model/GetAsyncBulkLookupResponse.md
@@ -0,0 +1,11 @@
+# GetAsyncBulkLookupResponse
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**links** | [**\Bandwidth\Model\LinkSchema[]**](LinkSchema.md) | | [optional]
+**data** | [**\Bandwidth\Model\GetAsyncBulkLookupResponseData**](GetAsyncBulkLookupResponseData.md) | | [optional]
+**errors** | [**\Bandwidth\Model\LookupErrorSchema[]**](LookupErrorSchema.md) | | [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/GetAsyncBulkLookupResponseData.md b/docs/Model/GetAsyncBulkLookupResponseData.md
new file mode 100644
index 0000000..f0a4530
--- /dev/null
+++ b/docs/Model/GetAsyncBulkLookupResponseData.md
@@ -0,0 +1,11 @@
+# GetAsyncBulkLookupResponseData
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**request_id** | **string** | The phone number lookup request ID from Bandwidth. | [optional]
+**status** | [**\Bandwidth\Model\InProgressLookupStatusEnum**](InProgressLookupStatusEnum.md) | | [optional]
+**results** | [**\Bandwidth\Model\LookupResult[]**](LookupResult.md) | The carrier information results for the specified telephone number. | [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/InProgressLookupStatusEnum.md b/docs/Model/InProgressLookupStatusEnum.md
new file mode 100644
index 0000000..cfbdbde
--- /dev/null
+++ b/docs/Model/InProgressLookupStatusEnum.md
@@ -0,0 +1,8 @@
+# InProgressLookupStatusEnum
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+
+[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
diff --git a/docs/Model/InboundCallback.md b/docs/Model/InboundCallback.md
new file mode 100644
index 0000000..f354409
--- /dev/null
+++ b/docs/Model/InboundCallback.md
@@ -0,0 +1,14 @@
+# InboundCallback
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**time** | **\DateTime** | |
+**type** | [**\Bandwidth\Model\InboundCallbackTypeEnum**](InboundCallbackTypeEnum.md) | |
+**to** | **string** | The destination phone number the message was sent to. For inbound callbacks, this is the Bandwidth number or alphanumeric identifier that received the message. |
+**description** | **string** | A detailed description of the event described by the callback. |
+**message** | [**\Bandwidth\Model\InboundCallbackMessage**](InboundCallbackMessage.md) | |
+**carrier_name** | **string** | The name of the Authorized Message Provider (AMP) that handled this message. In the US, this is the carrier that the message was sent to. This field is present only when this account feature has been enabled. | [optional]
+
+[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
diff --git a/docs/Model/InboundCallbackMessage.md b/docs/Model/InboundCallbackMessage.md
new file mode 100644
index 0000000..b96d8bf
--- /dev/null
+++ b/docs/Model/InboundCallbackMessage.md
@@ -0,0 +1,24 @@
+# InboundCallbackMessage
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**id** | **string** | A unique identifier of the message. |
+**owner** | **string** | The Bandwidth phone number or alphanumeric identifier associated with the message. |
+**application_id** | **string** | The ID of the Application your from number or senderId is associated with in the Bandwidth App. |
+**time** | **\DateTime** | |
+**segment_count** | **int** | The number of segments the user's message is broken into before sending over carrier networks. |
+**direction** | [**\Bandwidth\Model\MessageDirectionEnum**](MessageDirectionEnum.md) | |
+**to** | **string[]** | The phone number recipients of the message. |
+**from** | **string** | The Bandwidth phone number or alphanumeric identifier the message was sent from. |
+**text** | **string** | | [optional]
+**tag** | **string** | A custom string that will be included in callback events of the message. Max 1024 characters. | [optional]
+**media** | **string[]** | Optional media, not applicable for sms | [optional]
+**priority** | [**\Bandwidth\Model\PriorityEnum**](PriorityEnum.md) | | [optional]
+**channel** | [**\Bandwidth\Model\MultiChannelMessageChannelEnum**](MultiChannelMessageChannelEnum.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]
+
+[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
diff --git a/docs/Model/InboundCallbackTypeEnum.md b/docs/Model/InboundCallbackTypeEnum.md
new file mode 100644
index 0000000..39ed500
--- /dev/null
+++ b/docs/Model/InboundCallbackTypeEnum.md
@@ -0,0 +1,8 @@
+# InboundCallbackTypeEnum
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+
+[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
diff --git a/docs/Model/InitiateCallback.md b/docs/Model/InitiateCallback.md
new file mode 100644
index 0000000..4096e04
--- /dev/null
+++ b/docs/Model/InitiateCallback.md
@@ -0,0 +1,21 @@
+# InitiateCallback
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**event_type** | **string** | The event type, value can be one of the following: answer, bridgeComplete, bridgeTargetComplete, conferenceCreated, conferenceRedirect, conferenceMemberJoin, conferenceMemberExit, conferenceCompleted, conferenceRecordingAvailable, disconnect, dtmf, gather, initiate, machineDetectionComplete, recordingComplete, recordingAvailable, redirect, transcriptionAvailable, transferAnswer, transferComplete, transferDisconnect. | [optional]
+**event_time** | **\DateTime** | The approximate UTC date and time when the event was generated by the Bandwidth server, in ISO 8601 format. This may not be exactly the time of event execution. | [optional]
+**account_id** | **string** | The user account associated with the call. | [optional]
+**application_id** | **string** | The id of the application associated with the call. | [optional]
+**from** | **string** | The provided identifier of the caller. Must be a phone number in E.164 format (e.g. +15555555555). | [optional]
+**to** | **string** | The phone number that received the call, in E.164 format (e.g. +15555555555). | [optional]
+**direction** | [**\Bandwidth\Model\CallDirectionEnum**](CallDirectionEnum.md) | | [optional]
+**call_id** | **string** | The call id associated with the event. | [optional]
+**call_url** | **string** | The URL of the call associated with the event. | [optional]
+**start_time** | **\DateTime** | Time the call was started, in ISO 8601 format. | [optional]
+**diversion** | [**\Bandwidth\Model\Diversion**](Diversion.md) | | [optional]
+**stir_shaken** | [**\Bandwidth\Model\StirShaken**](StirShaken.md) | | [optional]
+**uui** | **string** | The value of the `User-To-User` header to send within the initial `INVITE`. Must include the encoding parameter as specified in RFC 7433. Only `base64`, `jwt` and `hex` encoding are currently allowed. This value, including the encoding specifier, may not exceed 256 characters. | [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/LatestMessageDeliveryStatusEnum.md b/docs/Model/LatestMessageDeliveryStatusEnum.md
new file mode 100644
index 0000000..1a815b4
--- /dev/null
+++ b/docs/Model/LatestMessageDeliveryStatusEnum.md
@@ -0,0 +1,8 @@
+# LatestMessageDeliveryStatusEnum
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+
+[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
diff --git a/docs/Model/LineTypeEnum.md b/docs/Model/LineTypeEnum.md
new file mode 100644
index 0000000..da9aa1d
--- /dev/null
+++ b/docs/Model/LineTypeEnum.md
@@ -0,0 +1,8 @@
+# LineTypeEnum
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+
+[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
diff --git a/docs/Model/Link.md b/docs/Model/Link.md
new file mode 100644
index 0000000..3c32c36
--- /dev/null
+++ b/docs/Model/Link.md
@@ -0,0 +1,10 @@
+# Link
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**rel** | **string** | | [optional]
+**href** | **string** | | [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/LinkSchema.md b/docs/Model/LinkSchema.md
new file mode 100644
index 0000000..f471ad1
--- /dev/null
+++ b/docs/Model/LinkSchema.md
@@ -0,0 +1,11 @@
+# LinkSchema
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**href** | **string** | URI of the link. | [optional]
+**rel** | **string** | Specifies the relationship between this link and the resource. | [optional]
+**method** | **string** | HTTP method to be used. | [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/LinksObject.md b/docs/Model/LinksObject.md
new file mode 100644
index 0000000..cc059c5
--- /dev/null
+++ b/docs/Model/LinksObject.md
@@ -0,0 +1,12 @@
+# LinksObject
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**first** | **string** | The first (or only) page of results matching the query. | [optional]
+**next** | **string** | If more results exist than specified by 'size', this link returns the next page of 'size' results. | [optional]
+**previous** | **string** | If the results are more than one page, this link returns the previous page of 'size' results. | [optional]
+**last** | **string** | If more results exist than specified by 'size', this link return the last page of result. | [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/ListEndpointsResponse.md b/docs/Model/ListEndpointsResponse.md
new file mode 100644
index 0000000..f01b1ba
--- /dev/null
+++ b/docs/Model/ListEndpointsResponse.md
@@ -0,0 +1,12 @@
+# ListEndpointsResponse
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**links** | [**\Bandwidth\Model\BrtcLink[]**](BrtcLink.md) | |
+**page** | [**\Bandwidth\Model\Page**](Page.md) | | [optional]
+**data** | [**\Bandwidth\Model\Endpoints[]**](Endpoints.md) | |
+**errors** | [**\Bandwidth\Model\BrtcError[]**](BrtcError.md) | |
+
+[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
diff --git a/docs/Model/ListMessageDirectionEnum.md b/docs/Model/ListMessageDirectionEnum.md
new file mode 100644
index 0000000..6cffce5
--- /dev/null
+++ b/docs/Model/ListMessageDirectionEnum.md
@@ -0,0 +1,8 @@
+# ListMessageDirectionEnum
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+
+[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
diff --git a/docs/Model/ListMessageItem.md b/docs/Model/ListMessageItem.md
new file mode 100644
index 0000000..bf7b090
--- /dev/null
+++ b/docs/Model/ListMessageItem.md
@@ -0,0 +1,31 @@
+# ListMessageItem
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**message_id** | **string** | The message id | [optional]
+**account_id** | **string** | The account id associated with this message. | [optional]
+**source_tn** | **string** | The source phone number of the message. | [optional]
+**destination_tn** | **string** | The recipient phone number of the message. | [optional]
+**message_status** | [**\Bandwidth\Model\MessageStatusEnum**](MessageStatusEnum.md) | | [optional]
+**message_direction** | [**\Bandwidth\Model\ListMessageDirectionEnum**](ListMessageDirectionEnum.md) | | [optional]
+**message_type** | [**\Bandwidth\Model\MessageTypeEnum**](MessageTypeEnum.md) | | [optional]
+**segment_count** | **int** | The number of segments the user's message is broken into before sending over carrier networks. | [optional]
+**error_code** | **int** | The numeric error code of the message. | [optional]
+**receive_time** | **\DateTime** | The ISO 8601 datetime of the message. | [optional]
+**carrier_name** | **string** | The name of the carrier. Not currently supported for MMS coming soon. | [optional]
+**message_size** | **int** | The size of the message including message content and headers. | [optional]
+**message_length** | **int** | The length of the message content. | [optional]
+**attachment_count** | **int** | The number of attachments the message has. | [optional]
+**recipient_count** | **int** | The number of recipients the message has. | [optional]
+**campaign_class** | **string** | The campaign class of the message if it has one. | [optional]
+**campaign_id** | **string** | The campaign ID of the message if it has one. | [optional]
+**bw_latency** | **int** | The Bandwidth latency of the message in seconds. Only available for accounts with the Advanced Quality Metrics feature enabled. | [optional]
+**carrier_latency** | **int** | The carrier latency of the message in seconds. Only available for OUTBOUND messages from accounts with the Advanced Quality Metrics feature enabled. | [optional]
+**calling_number_country_a3** | **string** | The A3 country code of the calling number. | [optional]
+**called_number_country_a3** | **string** | The A3 country code of the called number. | [optional]
+**product** | **string** | The messaging product associated with the message. | [optional]
+**location** | **string** | The location ID associated with this message. | [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/LookupErrorResponse.md b/docs/Model/LookupErrorResponse.md
new file mode 100644
index 0000000..c15beef
--- /dev/null
+++ b/docs/Model/LookupErrorResponse.md
@@ -0,0 +1,11 @@
+# LookupErrorResponse
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**links** | [**\Bandwidth\Model\LinkSchema[]**](LinkSchema.md) | | [optional]
+**data** | **object** | The phone number lookup response data | [optional]
+**errors** | [**\Bandwidth\Model\LookupErrorSchema[]**](LookupErrorSchema.md) | | [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/LookupErrorSchema.md b/docs/Model/LookupErrorSchema.md
new file mode 100644
index 0000000..b503053
--- /dev/null
+++ b/docs/Model/LookupErrorSchema.md
@@ -0,0 +1,12 @@
+# LookupErrorSchema
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**code** | **string** | Validation error code |
+**description** | **string** | Description of validation error |
+**type** | **string** | Type of validation error |
+**meta** | [**\Bandwidth\Model\LookupErrorSchemaMeta**](LookupErrorSchemaMeta.md) | | [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/LookupErrorSchemaMeta.md b/docs/Model/LookupErrorSchemaMeta.md
new file mode 100644
index 0000000..5519510
--- /dev/null
+++ b/docs/Model/LookupErrorSchemaMeta.md
@@ -0,0 +1,11 @@
+# LookupErrorSchemaMeta
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**phone_numbers** | **string[]** | | [optional]
+**message** | **string** | Message describing the error | [optional]
+**code** | **int** | Error code associated with the message | [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/LookupResult.md b/docs/Model/LookupResult.md
new file mode 100644
index 0000000..0a7c71e
--- /dev/null
+++ b/docs/Model/LookupResult.md
@@ -0,0 +1,20 @@
+# LookupResult
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**phone_number** | **string** | The telephone number in E.164 format. | [optional]
+**line_type** | [**\Bandwidth\Model\LineTypeEnum**](LineTypeEnum.md) | | [optional]
+**messaging_provider** | **string** | The messaging service provider of the telephone number. | [optional]
+**voice_provider** | **string** | The voice service provider of the telephone number. | [optional]
+**country_code_a3** | **string** | The country code of the telephone number in ISO 3166-1 alpha-3 format. | [optional]
+**deactivation_reporter** | **string** | [DNI-Only](#section/DNI-Only). The carrier that reported a deactivation event for this phone number. | [optional]
+**deactivation_date** | **string** | [DNI-Only](#section/DNI-Only). The datetime the carrier reported a deactivation event. | [optional]
+**deactivation_event** | [**\Bandwidth\Model\DeactivationEventEnum**](DeactivationEventEnum.md) | | [optional]
+**latest_message_delivery_status** | [**\Bandwidth\Model\LatestMessageDeliveryStatusEnum**](LatestMessageDeliveryStatusEnum.md) | | [optional]
+**initial_message_delivery_status_date** | **\DateTime** | [DNI-Only](#section/DNI-Only). The date the phone number entered the status described in `latestMessageDeliveryStatus`. Think of this as the \"start time\" for that status. Value resets every time the `latestMessageDeliveryStatus` changes. | [optional]
+**latest_message_delivery_status_date** | **\DateTime** | [DNI-Only](#section/DNI-Only). The date bandwidth last received delivery status information for this phone number. Use this field to understand how up-to-date the `latestMessageDeliveryStatus` is. Value resets every time the `latestMessageDeliveryStatus` changes. | [optional]
+**rcs_enabled** | **bool** | [RCS-Only](#section/RCS-Only). Indicates whether the phone number is capable of receiving RCS messages. Value will be null if account has RCS, but no value was returned. Absent when account does not have RCS. | [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/MachineDetectionCompleteCallback.md b/docs/Model/MachineDetectionCompleteCallback.md
new file mode 100644
index 0000000..8f5ae3a
--- /dev/null
+++ b/docs/Model/MachineDetectionCompleteCallback.md
@@ -0,0 +1,22 @@
+# MachineDetectionCompleteCallback
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**event_type** | **string** | The event type, value can be one of the following: answer, bridgeComplete, bridgeTargetComplete, conferenceCreated, conferenceRedirect, conferenceMemberJoin, conferenceMemberExit, conferenceCompleted, conferenceRecordingAvailable, disconnect, dtmf, gather, initiate, machineDetectionComplete, recordingComplete, recordingAvailable, redirect, transcriptionAvailable, transferAnswer, transferComplete, transferDisconnect. | [optional]
+**event_time** | **\DateTime** | The approximate UTC date and time when the event was generated by the Bandwidth server, in ISO 8601 format. This may not be exactly the time of event execution. | [optional]
+**account_id** | **string** | The user account associated with the call. | [optional]
+**application_id** | **string** | The id of the application associated with the call. | [optional]
+**from** | **string** | The provided identifier of the caller. Must be a phone number in E.164 format (e.g. +15555555555). | [optional]
+**to** | **string** | The phone number that received the call, in E.164 format (e.g. +15555555555). | [optional]
+**direction** | [**\Bandwidth\Model\CallDirectionEnum**](CallDirectionEnum.md) | | [optional]
+**call_id** | **string** | The call id associated with the event. | [optional]
+**call_url** | **string** | The URL of the call associated with the event. | [optional]
+**enqueued_time** | **\DateTime** | (optional) If call queueing is enabled and this is an outbound call, time the call was queued, in ISO 8601 format. | [optional]
+**start_time** | **\DateTime** | Time the call was started, in ISO 8601 format. | [optional]
+**answer_time** | **\DateTime** | Time the call was answered, in ISO 8601 format. | [optional]
+**tag** | **string** | (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present. | [optional]
+**machine_detection_result** | [**\Bandwidth\Model\MachineDetectionResult**](MachineDetectionResult.md) | | [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/MachineDetectionConfiguration.md b/docs/Model/MachineDetectionConfiguration.md
new file mode 100644
index 0000000..bf1bf0d
--- /dev/null
+++ b/docs/Model/MachineDetectionConfiguration.md
@@ -0,0 +1,23 @@
+# MachineDetectionConfiguration
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**mode** | [**\Bandwidth\Model\MachineDetectionModeEnum**](MachineDetectionModeEnum.md) | | [optional]
+**detection_timeout** | **float** | The timeout used for the whole operation, in seconds. If no result is determined in this period, a callback with a `timeout` result is sent. | [optional] [default to 15]
+**silence_timeout** | **float** | If no speech is detected in this period, a callback with a 'silence' result is sent. | [optional] [default to 10]
+**speech_threshold** | **float** | When speech has ended and a result couldn't be determined based on the audio content itself, this value is used to determine if the speaker is a machine based on the speech duration. If the length of the speech detected is greater than or equal to this threshold, the result will be 'answering-machine'. If the length of speech detected is below this threshold, the result will be 'human'. | [optional] [default to 10]
+**speech_end_threshold** | **float** | Amount of silence (in seconds) before assuming the callee has finished speaking. | [optional] [default to 5]
+**machine_speech_end_threshold** | **float** | When an answering machine is detected, the amount of silence (in seconds) before assuming the message has finished playing. If not provided it will default to the speechEndThreshold value. | [optional]
+**delay_result** | **bool** | If set to 'true' and if an answering machine is detected, the 'answering-machine' callback will be delayed until the machine is done speaking, or an end of message tone is detected, or until the 'detectionTimeout' is exceeded. If false, the 'answering-machine' result is sent immediately. | [optional] [default to false]
+**callback_url** | **string** | The URL to send the 'machineDetectionComplete' webhook when the detection is completed. Only for 'async' mode. | [optional]
+**callback_method** | [**\Bandwidth\Model\CallbackMethodEnum**](CallbackMethodEnum.md) | | [optional]
+**username** | **string** | Basic auth username. | [optional]
+**password** | **string** | Basic auth password. | [optional]
+**fallback_url** | **string** | A fallback URL which, if provided, will be used to retry the machine detection complete webhook delivery in case `callbackUrl` fails to respond | [optional]
+**fallback_method** | [**\Bandwidth\Model\CallbackMethodEnum**](CallbackMethodEnum.md) | | [optional]
+**fallback_username** | **string** | Basic auth username. | [optional]
+**fallback_password** | **string** | Basic auth password. | [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/MachineDetectionModeEnum.md b/docs/Model/MachineDetectionModeEnum.md
new file mode 100644
index 0000000..8d6bdd3
--- /dev/null
+++ b/docs/Model/MachineDetectionModeEnum.md
@@ -0,0 +1,8 @@
+# MachineDetectionModeEnum
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+
+[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
diff --git a/docs/Model/MachineDetectionResult.md b/docs/Model/MachineDetectionResult.md
new file mode 100644
index 0000000..d4c241d
--- /dev/null
+++ b/docs/Model/MachineDetectionResult.md
@@ -0,0 +1,10 @@
+# MachineDetectionResult
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**value** | **string** | Possible values are answering-machine, human, silence, timeout, or error. | [optional]
+**duration** | **string** | The amount of time it took to determine the result. | [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/Media.md b/docs/Model/Media.md
new file mode 100644
index 0000000..f0e615f
--- /dev/null
+++ b/docs/Model/Media.md
@@ -0,0 +1,11 @@
+# Media
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**content** | **string** | | [optional]
+**content_length** | **int** | | [optional]
+**media_name** | **string** | | [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/Message.md b/docs/Model/Message.md
new file mode 100644
index 0000000..4dd7686
--- /dev/null
+++ b/docs/Model/Message.md
@@ -0,0 +1,21 @@
+# Message
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**id** | **string** | The id of the message. | [optional]
+**owner** | **string** | The Bandwidth phone number associated with the message. | [optional]
+**application_id** | **string** | The ID of the Application your from number or senderId is associated with in the Bandwidth App. | [optional]
+**time** | **\DateTime** | The datetime stamp of the message in ISO 8601 | [optional]
+**segment_count** | **int** | The number of segments the user's message is broken into before sending over carrier networks. | [optional]
+**direction** | [**\Bandwidth\Model\MessageDirectionEnum**](MessageDirectionEnum.md) | | [optional]
+**to** | **string[]** | The phone number recipients of the message. | [optional]
+**from** | **string** | The phone number the message was sent from. | [optional]
+**media** | **string[]** | The list of media URLs sent in the message. Including a `filename` field in the `Content-Disposition` header of the media linked with a URL will set the displayed file name. This is a best practice to ensure that your media has a readable file name. | [optional]
+**text** | **string** | The contents of the message. | [optional]
+**tag** | **string** | A custom string that will be included in callback events of the message. Max 1024 characters. | [optional]
+**priority** | [**\Bandwidth\Model\PriorityEnum**](PriorityEnum.md) | | [optional]
+**expiration** | **\DateTime** | A string with the date/time value that the message will automatically expire by. This must be a valid RFC-3339 value, e.g., 2021-03-14T01:59:26Z or 2021-03-13T20:59:26-05:00. Must be a date-time in the future. | [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/MessageDirectionEnum.md b/docs/Model/MessageDirectionEnum.md
new file mode 100644
index 0000000..66ca35e
--- /dev/null
+++ b/docs/Model/MessageDirectionEnum.md
@@ -0,0 +1,8 @@
+# MessageDirectionEnum
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+
+[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
diff --git a/docs/Model/MessageRequest.md b/docs/Model/MessageRequest.md
new file mode 100644
index 0000000..391bf4f
--- /dev/null
+++ b/docs/Model/MessageRequest.md
@@ -0,0 +1,16 @@
+# MessageRequest
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**application_id** | **string** | The ID of the Application your from number or senderId is associated with in the Bandwidth App. |
+**to** | **string[]** | The phone number(s) the message should be sent to in E164 format. |
+**from** | **string** | Either an alphanumeric sender ID or the sender's Bandwidth phone number in E.164 format, which must be hosted within Bandwidth and linked to the account that is generating the message. Alphanumeric Sender IDs can contain up to 11 characters, upper-case letters A-Z, lower-case letters a-z, numbers 0-9, space, hyphen -, plus +, underscore _ and ampersand &. Alphanumeric Sender IDs must contain at least one letter. |
+**text** | **string** | The contents of the text message. Must be 2048 characters or less. | [optional]
+**media** | **string[]** | A list of URLs to include as media attachments as part of the message. Each URL can be at most 4096 characters. | [optional]
+**tag** | **string** | A custom string that will be included in callback events of the message. Max 1024 characters. | [optional]
+**priority** | [**\Bandwidth\Model\PriorityEnum**](PriorityEnum.md) | | [optional]
+**expiration** | **\DateTime** | A string with the date/time value that the message will automatically expire by. This must be a valid RFC-3339 value, e.g., 2021-03-14T01:59:26Z or 2021-03-13T20:59:26-05:00. Must be a date-time in the future. | [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/MessageStatusEnum.md b/docs/Model/MessageStatusEnum.md
new file mode 100644
index 0000000..66049bb
--- /dev/null
+++ b/docs/Model/MessageStatusEnum.md
@@ -0,0 +1,8 @@
+# MessageStatusEnum
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+
+[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
diff --git a/docs/Model/MessageTypeEnum.md b/docs/Model/MessageTypeEnum.md
new file mode 100644
index 0000000..520484e
--- /dev/null
+++ b/docs/Model/MessageTypeEnum.md
@@ -0,0 +1,8 @@
+# MessageTypeEnum
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+
+[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
diff --git a/docs/Model/MessagesList.md b/docs/Model/MessagesList.md
new file mode 100644
index 0000000..5422a85
--- /dev/null
+++ b/docs/Model/MessagesList.md
@@ -0,0 +1,11 @@
+# MessagesList
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**total_count** | **int** | The total number of messages matched by the search. When the request has limitTotalCount set to true this value is limited to 10,000. | [optional]
+**page_info** | [**\Bandwidth\Model\PageInfo**](PageInfo.md) | | [optional]
+**messages** | [**\Bandwidth\Model\ListMessageItem[]**](ListMessageItem.md) | | [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/MessagingCodeResponse.md b/docs/Model/MessagingCodeResponse.md
new file mode 100644
index 0000000..e53d356
--- /dev/null
+++ b/docs/Model/MessagingCodeResponse.md
@@ -0,0 +1,9 @@
+# MessagingCodeResponse
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**message_id** | **string** | Messaging API Message ID. | [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/MessagingRequestError.md b/docs/Model/MessagingRequestError.md
new file mode 100644
index 0000000..7a96a10
--- /dev/null
+++ b/docs/Model/MessagingRequestError.md
@@ -0,0 +1,10 @@
+# MessagingRequestError
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**type** | **string** | |
+**description** | **string** | |
+
+[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
diff --git a/docs/Model/MfaForbiddenRequestError.md b/docs/Model/MfaForbiddenRequestError.md
new file mode 100644
index 0000000..cf5356e
--- /dev/null
+++ b/docs/Model/MfaForbiddenRequestError.md
@@ -0,0 +1,9 @@
+# MfaForbiddenRequestError
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**message** | **string** | The message containing the reason behind the request being forbidden. | [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/MfaRequestError.md b/docs/Model/MfaRequestError.md
new file mode 100644
index 0000000..518e315
--- /dev/null
+++ b/docs/Model/MfaRequestError.md
@@ -0,0 +1,10 @@
+# MfaRequestError
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**error** | **string** | A message describing the error with your request. | [optional]
+**request_id** | **string** | The associated requestId from AWS. | [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/MfaUnauthorizedRequestError.md b/docs/Model/MfaUnauthorizedRequestError.md
new file mode 100644
index 0000000..efd1664
--- /dev/null
+++ b/docs/Model/MfaUnauthorizedRequestError.md
@@ -0,0 +1,9 @@
+# MfaUnauthorizedRequestError
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**message** | **string** | Unauthorized | [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/MmsMessageContent.md b/docs/Model/MmsMessageContent.md
new file mode 100644
index 0000000..c03e1eb
--- /dev/null
+++ b/docs/Model/MmsMessageContent.md
@@ -0,0 +1,10 @@
+# MmsMessageContent
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**text** | **string** | The contents of the text message. Must be 2048 characters or less. | [optional]
+**media** | [**\Bandwidth\Model\MmsMessageContentFile[]**](MmsMessageContentFile.md) | | [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/MmsMessageContentFile.md b/docs/Model/MmsMessageContentFile.md
new file mode 100644
index 0000000..7a5c67c
--- /dev/null
+++ b/docs/Model/MmsMessageContentFile.md
@@ -0,0 +1,9 @@
+# MmsMessageContentFile
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**file_url** | **string** | The URL of a media attachment. For MMS, the API limits file size to 3.5MB. Specific carriers and channels may have a smaller limit that could cause a large file to fail, see more at [Bandwidth Support](https://www.bandwidth.com/support/en/articles/12823216-what-are-the-mms-file-size-limits) for more details. |
+
+[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
diff --git a/docs/Model/MultiChannelAction.md b/docs/Model/MultiChannelAction.md
new file mode 100644
index 0000000..41741b2
--- /dev/null
+++ b/docs/Model/MultiChannelAction.md
@@ -0,0 +1,16 @@
+# MultiChannelAction
+
+This model is an `anyOf` wrapper: a value is at least one of the member types listed below.
+It is never instantiated directly — use one of the concrete types.
+
+## anyOf
+
+- [**\Bandwidth\Model\RbmActionBase**](RbmActionBase.md)
+- [**\Bandwidth\Model\RbmActionDial**](RbmActionDial.md)
+- [**\Bandwidth\Model\RbmActionViewLocation**](RbmActionViewLocation.md)
+- [**\Bandwidth\Model\MultiChannelActionCalendarEvent**](MultiChannelActionCalendarEvent.md)
+- [**\Bandwidth\Model\RbmActionOpenUrl**](RbmActionOpenUrl.md)
+
+The concrete type is selected by the `type` discriminator property.
+
+[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
diff --git a/docs/Model/MultiChannelActionCalendarEvent.md b/docs/Model/MultiChannelActionCalendarEvent.md
new file mode 100644
index 0000000..7a41991
--- /dev/null
+++ b/docs/Model/MultiChannelActionCalendarEvent.md
@@ -0,0 +1,15 @@
+# MultiChannelActionCalendarEvent
+
+## Properties
+
+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. |
+**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. |
+**description** | **string** | The description of the event. | [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/MultiChannelChannelListMMSObject.md b/docs/Model/MultiChannelChannelListMMSObject.md
new file mode 100644
index 0000000..e1b6dd7
--- /dev/null
+++ b/docs/Model/MultiChannelChannelListMMSObject.md
@@ -0,0 +1,12 @@
+# MultiChannelChannelListMMSObject
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**from** | **string** | The sender ID of the message. This could be an alphanumeric sender ID. |
+**application_id** | **string** | The ID of the Application your from number or senderId is associated with in the Bandwidth App. |
+**channel** | [**\Bandwidth\Model\MultiChannelMessageChannelEnum**](MultiChannelMessageChannelEnum.md) | |
+**content** | [**\Bandwidth\Model\MmsMessageContent**](MmsMessageContent.md) | |
+
+[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
diff --git a/docs/Model/MultiChannelChannelListMMSResponseObject.md b/docs/Model/MultiChannelChannelListMMSResponseObject.md
new file mode 100644
index 0000000..cda71d2
--- /dev/null
+++ b/docs/Model/MultiChannelChannelListMMSResponseObject.md
@@ -0,0 +1,13 @@
+# MultiChannelChannelListMMSResponseObject
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**from** | **string** | The sender ID of the message. This could be an alphanumeric sender ID. |
+**application_id** | **string** | The ID of the Application your from number or senderId is associated with in the Bandwidth App. |
+**channel** | [**\Bandwidth\Model\MultiChannelMessageChannelEnum**](MultiChannelMessageChannelEnum.md) | |
+**content** | [**\Bandwidth\Model\MmsMessageContent**](MmsMessageContent.md) | |
+**owner** | **string** | The Bandwidth senderId associated with the message. Identical to 'from'. |
+
+[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
diff --git a/docs/Model/MultiChannelChannelListObjectBase.md b/docs/Model/MultiChannelChannelListObjectBase.md
new file mode 100644
index 0000000..9539922
--- /dev/null
+++ b/docs/Model/MultiChannelChannelListObjectBase.md
@@ -0,0 +1,11 @@
+# MultiChannelChannelListObjectBase
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**from** | **string** | The sender ID of the message. This could be an alphanumeric sender ID. |
+**application_id** | **string** | The ID of the Application your from number or senderId is associated with in the Bandwidth App. |
+**channel** | [**\Bandwidth\Model\MultiChannelMessageChannelEnum**](MultiChannelMessageChannelEnum.md) | |
+
+[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
diff --git a/docs/Model/MultiChannelChannelListOwnerObject.md b/docs/Model/MultiChannelChannelListOwnerObject.md
new file mode 100644
index 0000000..e44a22d
--- /dev/null
+++ b/docs/Model/MultiChannelChannelListOwnerObject.md
@@ -0,0 +1,9 @@
+# MultiChannelChannelListOwnerObject
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**owner** | **string** | The Bandwidth senderId associated with the message. Identical to 'from'. |
+
+[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
diff --git a/docs/Model/MultiChannelChannelListRBMObject.md b/docs/Model/MultiChannelChannelListRBMObject.md
new file mode 100644
index 0000000..ef0ec8d
--- /dev/null
+++ b/docs/Model/MultiChannelChannelListRBMObject.md
@@ -0,0 +1,12 @@
+# MultiChannelChannelListRBMObject
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**from** | **string** | The sender ID of the message. This could be an alphanumeric sender ID. |
+**application_id** | **string** | The ID of the Application your from number or senderId is associated with in the Bandwidth App. |
+**channel** | [**\Bandwidth\Model\MultiChannelMessageChannelEnum**](MultiChannelMessageChannelEnum.md) | |
+**content** | [**\Bandwidth\Model\MultiChannelChannelListRBMObjectAllOfContent**](MultiChannelChannelListRBMObjectAllOfContent.md) | |
+
+[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
diff --git a/docs/Model/MultiChannelChannelListRBMObjectAllOfContent.md b/docs/Model/MultiChannelChannelListRBMObjectAllOfContent.md
new file mode 100644
index 0000000..d8e82e4
--- /dev/null
+++ b/docs/Model/MultiChannelChannelListRBMObjectAllOfContent.md
@@ -0,0 +1,13 @@
+# MultiChannelChannelListRBMObjectAllOfContent
+
+This model is a `oneOf` wrapper: a value is exactly one of the member types listed below.
+It is never instantiated directly — use one of the concrete types.
+
+## oneOf
+
+- [**\Bandwidth\Model\RbmMessageContentText**](RbmMessageContentText.md)
+- [**\Bandwidth\Model\RbmMessageMedia**](RbmMessageMedia.md)
+- [**\Bandwidth\Model\RbmStandaloneCard**](RbmStandaloneCard.md)
+- [**\Bandwidth\Model\RbmMessageCarouselCard**](RbmMessageCarouselCard.md)
+
+[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
diff --git a/docs/Model/MultiChannelChannelListRBMResponseObject.md b/docs/Model/MultiChannelChannelListRBMResponseObject.md
new file mode 100644
index 0000000..767cab7
--- /dev/null
+++ b/docs/Model/MultiChannelChannelListRBMResponseObject.md
@@ -0,0 +1,13 @@
+# MultiChannelChannelListRBMResponseObject
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**from** | **string** | The sender ID of the message. This could be an alphanumeric sender ID. |
+**application_id** | **string** | The ID of the Application your from number or senderId is associated with in the Bandwidth App. |
+**channel** | [**\Bandwidth\Model\MultiChannelMessageChannelEnum**](MultiChannelMessageChannelEnum.md) | |
+**content** | [**\Bandwidth\Model\MultiChannelChannelListRBMObjectAllOfContent**](MultiChannelChannelListRBMObjectAllOfContent.md) | |
+**owner** | **string** | The Bandwidth senderId associated with the message. Identical to 'from'. |
+
+[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
diff --git a/docs/Model/MultiChannelChannelListRequestObject.md b/docs/Model/MultiChannelChannelListRequestObject.md
new file mode 100644
index 0000000..bbd1af3
--- /dev/null
+++ b/docs/Model/MultiChannelChannelListRequestObject.md
@@ -0,0 +1,14 @@
+# MultiChannelChannelListRequestObject
+
+This model is an `anyOf` wrapper: a value is at least one of the member types listed below.
+It is never instantiated directly — use one of the concrete types.
+
+## anyOf
+
+- [**\Bandwidth\Model\MultiChannelChannelListRBMObject**](MultiChannelChannelListRBMObject.md)
+- [**\Bandwidth\Model\MultiChannelChannelListSMSObject**](MultiChannelChannelListSMSObject.md)
+- [**\Bandwidth\Model\MultiChannelChannelListMMSObject**](MultiChannelChannelListMMSObject.md)
+
+The concrete type is selected by the `channel` discriminator property.
+
+[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
diff --git a/docs/Model/MultiChannelChannelListResponseObject.md b/docs/Model/MultiChannelChannelListResponseObject.md
new file mode 100644
index 0000000..aa651d5
--- /dev/null
+++ b/docs/Model/MultiChannelChannelListResponseObject.md
@@ -0,0 +1,14 @@
+# MultiChannelChannelListResponseObject
+
+This model is an `anyOf` wrapper: a value is at least one of the member types listed below.
+It is never instantiated directly — use one of the concrete types.
+
+## anyOf
+
+- [**\Bandwidth\Model\MultiChannelChannelListRBMResponseObject**](MultiChannelChannelListRBMResponseObject.md)
+- [**\Bandwidth\Model\MultiChannelChannelListSMSResponseObject**](MultiChannelChannelListSMSResponseObject.md)
+- [**\Bandwidth\Model\MultiChannelChannelListMMSResponseObject**](MultiChannelChannelListMMSResponseObject.md)
+
+The concrete type is selected by the `channel` discriminator property.
+
+[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
diff --git a/docs/Model/MultiChannelChannelListSMSObject.md b/docs/Model/MultiChannelChannelListSMSObject.md
new file mode 100644
index 0000000..922b58b
--- /dev/null
+++ b/docs/Model/MultiChannelChannelListSMSObject.md
@@ -0,0 +1,12 @@
+# MultiChannelChannelListSMSObject
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**from** | **string** | The sender ID of the message. This could be an alphanumeric sender ID. |
+**application_id** | **string** | The ID of the Application your from number or senderId is associated with in the Bandwidth App. |
+**channel** | [**\Bandwidth\Model\MultiChannelMessageChannelEnum**](MultiChannelMessageChannelEnum.md) | |
+**content** | [**\Bandwidth\Model\SmsMessageContent**](SmsMessageContent.md) | |
+
+[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
diff --git a/docs/Model/MultiChannelChannelListSMSResponseObject.md b/docs/Model/MultiChannelChannelListSMSResponseObject.md
new file mode 100644
index 0000000..b48fcc1
--- /dev/null
+++ b/docs/Model/MultiChannelChannelListSMSResponseObject.md
@@ -0,0 +1,13 @@
+# MultiChannelChannelListSMSResponseObject
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**from** | **string** | The sender ID of the message. This could be an alphanumeric sender ID. |
+**application_id** | **string** | The ID of the Application your from number or senderId is associated with in the Bandwidth App. |
+**channel** | [**\Bandwidth\Model\MultiChannelMessageChannelEnum**](MultiChannelMessageChannelEnum.md) | |
+**content** | [**\Bandwidth\Model\SmsMessageContent**](SmsMessageContent.md) | |
+**owner** | **string** | The Bandwidth senderId associated with the message. Identical to 'from'. |
+
+[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
diff --git a/docs/Model/MultiChannelError.md b/docs/Model/MultiChannelError.md
new file mode 100644
index 0000000..baed1f1
--- /dev/null
+++ b/docs/Model/MultiChannelError.md
@@ -0,0 +1,11 @@
+# MultiChannelError
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**links** | [**\Bandwidth\Model\Link[]**](Link.md) | | [optional]
+**data** | **object** | | [optional]
+**errors** | [**\Bandwidth\Model\ErrorObject[]**](ErrorObject.md) | | [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/MultiChannelMessageChannelEnum.md b/docs/Model/MultiChannelMessageChannelEnum.md
new file mode 100644
index 0000000..7a93619
--- /dev/null
+++ b/docs/Model/MultiChannelMessageChannelEnum.md
@@ -0,0 +1,8 @@
+# MultiChannelMessageChannelEnum
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+
+[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
diff --git a/docs/Model/MultiChannelMessageContent.md b/docs/Model/MultiChannelMessageContent.md
new file mode 100644
index 0000000..9e95b70
--- /dev/null
+++ b/docs/Model/MultiChannelMessageContent.md
@@ -0,0 +1,10 @@
+# MultiChannelMessageContent
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**text** | **string** | | [optional]
+**media** | [**\Bandwidth\Model\RbmMessageContentFile**](RbmMessageContentFile.md) | | [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/MultiChannelMessageRequest.md b/docs/Model/MultiChannelMessageRequest.md
new file mode 100644
index 0000000..0a61eaa
--- /dev/null
+++ b/docs/Model/MultiChannelMessageRequest.md
@@ -0,0 +1,13 @@
+# MultiChannelMessageRequest
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**to** | **string** | The phone number the message should be sent to in E164 format. |
+**channel_list** | [**\Bandwidth\Model\MultiChannelChannelListRequestObject[]**](MultiChannelChannelListRequestObject.md) | A list of message bodies. The messages will be attempted in the order they are listed. Once a message sends successfully, the others will be ignored. |
+**tag** | **string** | A custom string that will be included in callback events of the message. Max 1024 characters. | [optional]
+**priority** | [**\Bandwidth\Model\PriorityEnum**](PriorityEnum.md) | | [optional]
+**expiration** | **\DateTime** | A string with the date/time value that the message will automatically expire by. This must be a valid RFC-3339 value, e.g., 2021-03-14T01:59:26Z or 2021-03-13T20:59:26-05:00. Must be a date-time in the future. | [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/MultiChannelMessageResponseData.md b/docs/Model/MultiChannelMessageResponseData.md
new file mode 100644
index 0000000..c120148
--- /dev/null
+++ b/docs/Model/MultiChannelMessageResponseData.md
@@ -0,0 +1,16 @@
+# MultiChannelMessageResponseData
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**id** | **string** | The ID of the message. |
+**time** | **\DateTime** | The time the message was received by the Bandwidth API. |
+**direction** | [**\Bandwidth\Model\MessageDirectionEnum**](MessageDirectionEnum.md) | |
+**to** | **string[]** | The destination phone number(s) of the message, in E164 format. |
+**channel_list** | [**\Bandwidth\Model\MultiChannelChannelListResponseObject[]**](MultiChannelChannelListResponseObject.md) | A list of message bodies. The messages will be attempted in the order they are listed. Once a message sends successfully, the others will be ignored. |
+**tag** | **string** | A custom string that will be included in callback events of the message. Max 1024 characters. | [optional]
+**priority** | [**\Bandwidth\Model\PriorityEnum**](PriorityEnum.md) | | [optional]
+**expiration** | **\DateTime** | A string with the date/time value that the message will automatically expire by. This must be a valid RFC-3339 value, e.g., 2021-03-14T01:59:26Z or 2021-03-13T20:59:26-05:00. Must be a date-time in the future. | [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/OptInWorkflow.md b/docs/Model/OptInWorkflow.md
new file mode 100644
index 0000000..c9857d3
--- /dev/null
+++ b/docs/Model/OptInWorkflow.md
@@ -0,0 +1,11 @@
+# OptInWorkflow
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**description** | **string** | |
+**image_urls** | **string[]** | |
+**confirmation_response** | **string** | | [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/Page.md b/docs/Model/Page.md
new file mode 100644
index 0000000..7f9263e
--- /dev/null
+++ b/docs/Model/Page.md
@@ -0,0 +1,12 @@
+# Page
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**page_size** | **int** | The number of items per page. |
+**total_elements** | **int** | The total number of items. | [optional]
+**total_pages** | **int** | The total number of pages. | [optional]
+**page_number** | **int** | The current page number. | [optional]
+
+[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
diff --git a/docs/Model/PageInfo.md b/docs/Model/PageInfo.md
new file mode 100644
index 0000000..ed31308
--- /dev/null
+++ b/docs/Model/PageInfo.md
@@ -0,0 +1,12 @@
+# PageInfo
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**prev_page** | **string** | The link to the previous page for pagination. | [optional]
+**next_page** | **string** | The link to the next page for pagination. | [optional]
+**prev_page_token** | **string** | The isolated pagination token for the previous page. | [optional]
+**next_page_token** | **string** | The isolated pagination token for the next page. | [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/PriorityEnum.md b/docs/Model/PriorityEnum.md
new file mode 100644
index 0000000..c1fe165
--- /dev/null
+++ b/docs/Model/PriorityEnum.md
@@ -0,0 +1,8 @@
+# PriorityEnum
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+
+[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
diff --git a/docs/Model/ProductTypeEnum.md b/docs/Model/ProductTypeEnum.md
new file mode 100644
index 0000000..f02ecf1
--- /dev/null
+++ b/docs/Model/ProductTypeEnum.md
@@ -0,0 +1,8 @@
+# ProductTypeEnum
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+
+[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
diff --git a/docs/Model/RbmActionBase.md b/docs/Model/RbmActionBase.md
new file mode 100644
index 0000000..9e641fe
--- /dev/null
+++ b/docs/Model/RbmActionBase.md
@@ -0,0 +1,11 @@
+# RbmActionBase
+
+## Properties
+
+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. |
+
+[[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
new file mode 100644
index 0000000..0744ebd
--- /dev/null
+++ b/docs/Model/RbmActionDial.md
@@ -0,0 +1,12 @@
+# RbmActionDial
+
+## Properties
+
+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. |
+**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
new file mode 100644
index 0000000..e3c1631
--- /dev/null
+++ b/docs/Model/RbmActionOpenUrl.md
@@ -0,0 +1,14 @@
+# RbmActionOpenUrl
+
+## Properties
+
+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. |
+**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]
+
+[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
diff --git a/docs/Model/RbmActionTypeEnum.md b/docs/Model/RbmActionTypeEnum.md
new file mode 100644
index 0000000..57bb63e
--- /dev/null
+++ b/docs/Model/RbmActionTypeEnum.md
@@ -0,0 +1,8 @@
+# RbmActionTypeEnum
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+
+[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
diff --git a/docs/Model/RbmActionViewLocation.md b/docs/Model/RbmActionViewLocation.md
new file mode 100644
index 0000000..2fb12d5
--- /dev/null
+++ b/docs/Model/RbmActionViewLocation.md
@@ -0,0 +1,14 @@
+# RbmActionViewLocation
+
+## Properties
+
+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. |
+**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]
+
+[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
diff --git a/docs/Model/RbmCardContent.md b/docs/Model/RbmCardContent.md
new file mode 100644
index 0000000..8405875
--- /dev/null
+++ b/docs/Model/RbmCardContent.md
@@ -0,0 +1,12 @@
+# RbmCardContent
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**title** | **string** | The title of the card. Must be 200 characters or less. | [optional]
+**description** | **string** | The description of the card. Must be 2000 characters or less. | [optional]
+**media** | [**\Bandwidth\Model\RbmCardContentMedia**](RbmCardContentMedia.md) | | [optional]
+**suggestions** | [**\Bandwidth\Model\MultiChannelAction[]**](MultiChannelAction.md) | An array of suggested actions for the recipient that will be displayed on the rich card. | [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/RbmCardContentMedia.md b/docs/Model/RbmCardContentMedia.md
new file mode 100644
index 0000000..c861823
--- /dev/null
+++ b/docs/Model/RbmCardContentMedia.md
@@ -0,0 +1,11 @@
+# RbmCardContentMedia
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**file_url** | **string** | The URL of the media file. 100MB is the maximum file size. |
+**thumbnail_url** | **string** | The URL of the thumbnail image. Applies only to video file media. | [optional]
+**height** | [**\Bandwidth\Model\RbmMediaHeightEnum**](RbmMediaHeightEnum.md) | |
+
+[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
diff --git a/docs/Model/RbmLocationResponse.md b/docs/Model/RbmLocationResponse.md
new file mode 100644
index 0000000..2538c92
--- /dev/null
+++ b/docs/Model/RbmLocationResponse.md
@@ -0,0 +1,10 @@
+# RbmLocationResponse
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**latitude** | **float** | The latitude of the client's location. | [optional]
+**longitude** | **float** | The longitude of the client's location. | [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/RbmMediaHeightEnum.md b/docs/Model/RbmMediaHeightEnum.md
new file mode 100644
index 0000000..d3634cf
--- /dev/null
+++ b/docs/Model/RbmMediaHeightEnum.md
@@ -0,0 +1,8 @@
+# RbmMediaHeightEnum
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+
+[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
diff --git a/docs/Model/RbmMessageCarouselCard.md b/docs/Model/RbmMessageCarouselCard.md
new file mode 100644
index 0000000..bb27bc3
--- /dev/null
+++ b/docs/Model/RbmMessageCarouselCard.md
@@ -0,0 +1,11 @@
+# RbmMessageCarouselCard
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**card_width** | [**\Bandwidth\Model\CardWidthEnum**](CardWidthEnum.md) | |
+**card_contents** | [**\Bandwidth\Model\RbmCardContent[]**](RbmCardContent.md) | |
+**suggestions** | [**\Bandwidth\Model\MultiChannelAction[]**](MultiChannelAction.md) | An array of suggested actions for the recipient. | [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/RbmMessageContentFile.md b/docs/Model/RbmMessageContentFile.md
new file mode 100644
index 0000000..0c245d7
--- /dev/null
+++ b/docs/Model/RbmMessageContentFile.md
@@ -0,0 +1,10 @@
+# RbmMessageContentFile
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**file_url** | **string** | The URL of the media file. 100MB is the maximum file size. |
+**thumbnail_url** | **string** | The URL of the thumbnail image. Applies only to video file media. | [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/RbmMessageContentRichCard.md b/docs/Model/RbmMessageContentRichCard.md
new file mode 100644
index 0000000..56fb0d3
--- /dev/null
+++ b/docs/Model/RbmMessageContentRichCard.md
@@ -0,0 +1,11 @@
+# RbmMessageContentRichCard
+
+This model is a `oneOf` wrapper: a value is exactly one of the member types listed below.
+It is never instantiated directly — use one of the concrete types.
+
+## oneOf
+
+- [**\Bandwidth\Model\RbmStandaloneCard**](RbmStandaloneCard.md)
+- [**\Bandwidth\Model\RbmMessageCarouselCard**](RbmMessageCarouselCard.md)
+
+[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
diff --git a/docs/Model/RbmMessageContentText.md b/docs/Model/RbmMessageContentText.md
new file mode 100644
index 0000000..c0f3a40
--- /dev/null
+++ b/docs/Model/RbmMessageContentText.md
@@ -0,0 +1,10 @@
+# RbmMessageContentText
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**text** | **string** | The text associated with the message. Must be 3270 characters or less |
+**suggestions** | [**\Bandwidth\Model\MultiChannelAction[]**](MultiChannelAction.md) | An array of suggested actions for the recipient. | [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/RbmMessageMedia.md b/docs/Model/RbmMessageMedia.md
new file mode 100644
index 0000000..4d201b0
--- /dev/null
+++ b/docs/Model/RbmMessageMedia.md
@@ -0,0 +1,10 @@
+# RbmMessageMedia
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**media** | [**\Bandwidth\Model\RbmMessageContentFile[]**](RbmMessageContentFile.md) | |
+**suggestions** | [**\Bandwidth\Model\MultiChannelAction[]**](MultiChannelAction.md) | An array of suggested actions for the recipient. | [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/RbmOpenUrlEnum.md b/docs/Model/RbmOpenUrlEnum.md
new file mode 100644
index 0000000..ff4e99d
--- /dev/null
+++ b/docs/Model/RbmOpenUrlEnum.md
@@ -0,0 +1,8 @@
+# RbmOpenUrlEnum
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+
+[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
diff --git a/docs/Model/RbmStandaloneCard.md b/docs/Model/RbmStandaloneCard.md
new file mode 100644
index 0000000..0060133
--- /dev/null
+++ b/docs/Model/RbmStandaloneCard.md
@@ -0,0 +1,12 @@
+# RbmStandaloneCard
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**orientation** | [**\Bandwidth\Model\StandaloneCardOrientationEnum**](StandaloneCardOrientationEnum.md) | |
+**thumbnail_image_alignment** | [**\Bandwidth\Model\ThumbnailAlignmentEnum**](ThumbnailAlignmentEnum.md) | | [optional]
+**card_content** | [**\Bandwidth\Model\RbmCardContent**](RbmCardContent.md) | |
+**suggestions** | [**\Bandwidth\Model\MultiChannelAction[]**](MultiChannelAction.md) | An array of suggested actions for the recipient. | [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
new file mode 100644
index 0000000..f446379
--- /dev/null
+++ b/docs/Model/RbmSuggestionResponse.md
@@ -0,0 +1,11 @@
+# RbmSuggestionResponse
+
+## Properties
+
+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]
+**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/RbmWebViewEnum.md b/docs/Model/RbmWebViewEnum.md
new file mode 100644
index 0000000..72c6554
--- /dev/null
+++ b/docs/Model/RbmWebViewEnum.md
@@ -0,0 +1,8 @@
+# RbmWebViewEnum
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+
+[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
diff --git a/docs/Model/RecordingAvailableCallback.md b/docs/Model/RecordingAvailableCallback.md
new file mode 100644
index 0000000..cdf0c49
--- /dev/null
+++ b/docs/Model/RecordingAvailableCallback.md
@@ -0,0 +1,30 @@
+# RecordingAvailableCallback
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**event_type** | **string** | The event type, value can be one of the following: answer, bridgeComplete, bridgeTargetComplete, conferenceCreated, conferenceRedirect, conferenceMemberJoin, conferenceMemberExit, conferenceCompleted, conferenceRecordingAvailable, disconnect, dtmf, gather, initiate, machineDetectionComplete, recordingComplete, recordingAvailable, redirect, transcriptionAvailable, transferAnswer, transferComplete, transferDisconnect. | [optional]
+**event_time** | **\DateTime** | The approximate UTC date and time when the event was generated by the Bandwidth server, in ISO 8601 format. This may not be exactly the time of event execution. | [optional]
+**account_id** | **string** | The user account associated with the call. | [optional]
+**application_id** | **string** | The id of the application associated with the call. | [optional]
+**from** | **string** | The provided identifier of the caller. Must be a phone number in E.164 format (e.g. +15555555555). | [optional]
+**to** | **string** | The phone number that received the call, in E.164 format (e.g. +15555555555). | [optional]
+**direction** | [**\Bandwidth\Model\CallDirectionEnum**](CallDirectionEnum.md) | | [optional]
+**call_id** | **string** | The call id associated with the event. | [optional]
+**call_url** | **string** | The URL of the call associated with the event. | [optional]
+**parent_call_id** | **string** | (optional) If the event is related to the B leg of a <Transfer>, the call id of the original call leg that executed the <Transfer>. Otherwise, this field will not be present. | [optional]
+**recording_id** | **string** | The unique ID of this recording | [optional]
+**media_url** | **string** | The URL that can be used to download the recording. Only present if the recording is finished and may be downloaded. | [optional]
+**enqueued_time** | **\DateTime** | (optional) If call queueing is enabled and this is an outbound call, time the call was queued, in ISO 8601 format. | [optional]
+**start_time** | **\DateTime** | Time the call was started, in ISO 8601 format. | [optional]
+**end_time** | **\DateTime** | The time that the recording ended in ISO-8601 format | [optional]
+**duration** | **string** | The duration of the recording in ISO-8601 format | [optional]
+**file_format** | [**\Bandwidth\Model\FileFormatEnum**](FileFormatEnum.md) | | [optional]
+**channels** | **int** | Always `1` for conference recordings; multi-channel recordings are not supported on conferences. | [optional]
+**tag** | **string** | (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present. | [optional]
+**status** | **string** | The current status of the process. For recording, current possible values are 'processing', 'partial', 'complete', 'deleted', and 'error'. For transcriptions, current possible values are 'none', 'processing', 'available', 'error', 'timeout', 'file-size-too-big', and 'file-size-too-small'. Additional states may be added in the future, so your application must be tolerant of unknown values. | [optional]
+**transfer_caller_id** | **string** | The phone number used as the from field of the B-leg call, in E.164 format (e.g. +15555555555). | [optional]
+**transfer_to** | **string** | The phone number used as the to field of the B-leg call, in E.164 format (e.g. +15555555555). | [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/RecordingCompleteCallback.md b/docs/Model/RecordingCompleteCallback.md
new file mode 100644
index 0000000..1d427fd
--- /dev/null
+++ b/docs/Model/RecordingCompleteCallback.md
@@ -0,0 +1,30 @@
+# RecordingCompleteCallback
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**event_type** | **string** | The event type, value can be one of the following: answer, bridgeComplete, bridgeTargetComplete, conferenceCreated, conferenceRedirect, conferenceMemberJoin, conferenceMemberExit, conferenceCompleted, conferenceRecordingAvailable, disconnect, dtmf, gather, initiate, machineDetectionComplete, recordingComplete, recordingAvailable, redirect, transcriptionAvailable, transferAnswer, transferComplete, transferDisconnect. | [optional]
+**event_time** | **\DateTime** | The approximate UTC date and time when the event was generated by the Bandwidth server, in ISO 8601 format. This may not be exactly the time of event execution. | [optional]
+**account_id** | **string** | The user account associated with the call. | [optional]
+**application_id** | **string** | The id of the application associated with the call. | [optional]
+**from** | **string** | The provided identifier of the caller. Must be a phone number in E.164 format (e.g. +15555555555). | [optional]
+**to** | **string** | The phone number that received the call, in E.164 format (e.g. +15555555555). | [optional]
+**direction** | [**\Bandwidth\Model\CallDirectionEnum**](CallDirectionEnum.md) | | [optional]
+**call_id** | **string** | The call id associated with the event. | [optional]
+**call_url** | **string** | The URL of the call associated with the event. | [optional]
+**parent_call_id** | **string** | (optional) If the event is related to the B leg of a <Transfer>, the call id of the original call leg that executed the <Transfer>. Otherwise, this field will not be present. | [optional]
+**recording_id** | **string** | The unique ID of this recording | [optional]
+**media_url** | **string** | The URL that can be used to download the recording. Only present if the recording is finished and may be downloaded. | [optional]
+**enqueued_time** | **\DateTime** | (optional) If call queueing is enabled and this is an outbound call, time the call was queued, in ISO 8601 format. | [optional]
+**start_time** | **\DateTime** | Time the call was started, in ISO 8601 format. | [optional]
+**answer_time** | **\DateTime** | Time the call was answered, in ISO 8601 format. | [optional]
+**end_time** | **\DateTime** | The time that the recording ended in ISO-8601 format | [optional]
+**duration** | **string** | The duration of the recording in ISO-8601 format | [optional]
+**file_format** | [**\Bandwidth\Model\FileFormatEnum**](FileFormatEnum.md) | | [optional]
+**channels** | **int** | Always `1` for conference recordings; multi-channel recordings are not supported on conferences. | [optional]
+**tag** | **string** | (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present. | [optional]
+**transfer_caller_id** | **string** | The phone number used as the from field of the B-leg call, in E.164 format (e.g. +15555555555). | [optional]
+**transfer_to** | **string** | The phone number used as the to field of the B-leg call, in E.164 format (e.g. +15555555555). | [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/RecordingStateEnum.md b/docs/Model/RecordingStateEnum.md
new file mode 100644
index 0000000..38d6f5c
--- /dev/null
+++ b/docs/Model/RecordingStateEnum.md
@@ -0,0 +1,8 @@
+# RecordingStateEnum
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+
+[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
diff --git a/docs/Model/RecordingTranscriptionClip.md b/docs/Model/RecordingTranscriptionClip.md
new file mode 100644
index 0000000..98cba8e
--- /dev/null
+++ b/docs/Model/RecordingTranscriptionClip.md
@@ -0,0 +1,13 @@
+# RecordingTranscriptionClip
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**speaker** | **int** | Zero-based index identifying the speaker. | [optional]
+**text** | **string** | The transcribed text of this clip. | [optional]
+**confidence** | **float** | How confident the transcription engine was in transcribing this clip (from `0.0` to `1.0`). | [optional]
+**start_time_seconds** | **float** | The start time of this clip within the recording, in seconds. | [optional]
+**end_time_seconds** | **float** | The end time of this clip within the recording, in seconds. | [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/RecordingTranscriptionMetadata.md b/docs/Model/RecordingTranscriptionMetadata.md
new file mode 100644
index 0000000..aa9a956
--- /dev/null
+++ b/docs/Model/RecordingTranscriptionMetadata.md
@@ -0,0 +1,12 @@
+# RecordingTranscriptionMetadata
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**id** | **string** | The unique transcription ID | [optional]
+**status** | **string** | The current status of the process. For recording, current possible values are 'processing', 'partial', 'complete', 'deleted', and 'error'. For transcriptions, current possible values are 'none', 'processing', 'available', 'error', 'timeout', 'file-size-too-big', and 'file-size-too-small'. Additional states may be added in the future, so your application must be tolerant of unknown values. | [optional]
+**completed_time** | **\DateTime** | The time that the transcription was completed | [optional]
+**url** | **string** | The URL of the [transcription](#operation/getCallTranscription) | [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/RecordingTranscriptions.md b/docs/Model/RecordingTranscriptions.md
new file mode 100644
index 0000000..f0bb6cb
--- /dev/null
+++ b/docs/Model/RecordingTranscriptions.md
@@ -0,0 +1,10 @@
+# RecordingTranscriptions
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**transcripts** | [**\Bandwidth\Model\Transcription[]**](Transcription.md) | | [optional]
+**clips** | [**\Bandwidth\Model\RecordingTranscriptionClip[]**](RecordingTranscriptionClip.md) | A list of individual speech clips with speaker, timing, and confidence information. | [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/RedirectCallback.md b/docs/Model/RedirectCallback.md
new file mode 100644
index 0000000..e332593
--- /dev/null
+++ b/docs/Model/RedirectCallback.md
@@ -0,0 +1,24 @@
+# RedirectCallback
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**event_type** | **string** | The event type, value can be one of the following: answer, bridgeComplete, bridgeTargetComplete, conferenceCreated, conferenceRedirect, conferenceMemberJoin, conferenceMemberExit, conferenceCompleted, conferenceRecordingAvailable, disconnect, dtmf, gather, initiate, machineDetectionComplete, recordingComplete, recordingAvailable, redirect, transcriptionAvailable, transferAnswer, transferComplete, transferDisconnect. | [optional]
+**event_time** | **\DateTime** | The approximate UTC date and time when the event was generated by the Bandwidth server, in ISO 8601 format. This may not be exactly the time of event execution. | [optional]
+**account_id** | **string** | The user account associated with the call. | [optional]
+**application_id** | **string** | The id of the application associated with the call. | [optional]
+**from** | **string** | The provided identifier of the caller. Must be a phone number in E.164 format (e.g. +15555555555). | [optional]
+**to** | **string** | The phone number that received the call, in E.164 format (e.g. +15555555555). | [optional]
+**direction** | [**\Bandwidth\Model\CallDirectionEnum**](CallDirectionEnum.md) | | [optional]
+**call_id** | **string** | The call id associated with the event. | [optional]
+**call_url** | **string** | The URL of the call associated with the event. | [optional]
+**parent_call_id** | **string** | (optional) If the event is related to the B leg of a <Transfer>, the call id of the original call leg that executed the <Transfer>. Otherwise, this field will not be present. | [optional]
+**enqueued_time** | **\DateTime** | (optional) If call queueing is enabled and this is an outbound call, time the call was queued, in ISO 8601 format. | [optional]
+**start_time** | **\DateTime** | Time the call was started, in ISO 8601 format. | [optional]
+**answer_time** | **\DateTime** | Time the call was answered, in ISO 8601 format. | [optional]
+**tag** | **string** | (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present. | [optional]
+**transfer_caller_id** | **string** | The phone number used as the from field of the B-leg call, in E.164 format (e.g. +15555555555). | [optional]
+**transfer_to** | **string** | The phone number used as the to field of the B-leg call, in E.164 format (e.g. +15555555555). | [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/RedirectMethodEnum.md b/docs/Model/RedirectMethodEnum.md
new file mode 100644
index 0000000..bab5206
--- /dev/null
+++ b/docs/Model/RedirectMethodEnum.md
@@ -0,0 +1,8 @@
+# RedirectMethodEnum
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+
+[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
diff --git a/docs/Model/SipConnectionMetadata.md b/docs/Model/SipConnectionMetadata.md
new file mode 100644
index 0000000..4b62196
--- /dev/null
+++ b/docs/Model/SipConnectionMetadata.md
@@ -0,0 +1,12 @@
+# SipConnectionMetadata
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**ip_address** | **string** | The IP address of the SIP connection. | [optional]
+**port** | **int** | The port of the SIP connection. | [optional]
+**credentials** | [**\Bandwidth\Model\SipCredentials**](SipCredentials.md) | | [optional]
+**uui_header** | **string** | The User-to-User Information header for the SIP connection. | [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/SipCredentials.md b/docs/Model/SipCredentials.md
new file mode 100644
index 0000000..2c1841f
--- /dev/null
+++ b/docs/Model/SipCredentials.md
@@ -0,0 +1,10 @@
+# SipCredentials
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**username** | **string** | The username for the SIP connection. | [optional]
+**password** | **string** | The password for the SIP connection. | [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/SmsMessageContent.md b/docs/Model/SmsMessageContent.md
new file mode 100644
index 0000000..6982f08
--- /dev/null
+++ b/docs/Model/SmsMessageContent.md
@@ -0,0 +1,9 @@
+# SmsMessageContent
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**text** | **string** | The contents of the text message. Must be 2048 characters or less. |
+
+[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
diff --git a/docs/Model/StandaloneCardOrientationEnum.md b/docs/Model/StandaloneCardOrientationEnum.md
new file mode 100644
index 0000000..965564f
--- /dev/null
+++ b/docs/Model/StandaloneCardOrientationEnum.md
@@ -0,0 +1,8 @@
+# StandaloneCardOrientationEnum
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+
+[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
diff --git a/docs/Model/StatusCallback.md b/docs/Model/StatusCallback.md
new file mode 100644
index 0000000..19e6f3c
--- /dev/null
+++ b/docs/Model/StatusCallback.md
@@ -0,0 +1,16 @@
+# StatusCallback
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**time** | **\DateTime** | |
+**event_time** | **\DateTime** | Represents the time at which the message was read, for `message-read` callbacks. | [optional]
+**type** | [**\Bandwidth\Model\StatusCallbackTypeEnum**](StatusCallbackTypeEnum.md) | |
+**to** | **string** | The destination phone number the message was sent to. For status callbacks, this the the Bandwidth user's client phone number. |
+**description** | **string** | A detailed description of the event described by the callback. |
+**message** | [**\Bandwidth\Model\StatusCallbackMessage**](StatusCallbackMessage.md) | |
+**error_code** | **int** | Optional error code, applicable only when type is `message-failed`. | [optional]
+**carrier_name** | **string** | The name of the Authorized Message Provider (AMP) that handled this message. In the US, this is the carrier that the message was sent to. This field is present only when this account feature has been enabled. | [optional]
+
+[[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
new file mode 100644
index 0000000..286542f
--- /dev/null
+++ b/docs/Model/StatusCallbackMessage.md
@@ -0,0 +1,21 @@
+# StatusCallbackMessage
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**id** | **string** | A unique identifier of the message. |
+**owner** | **string** | The Bandwidth phone number or alphanumeric identifier associated with the message. |
+**application_id** | **string** | The ID of the Application your from number or senderId is associated with in the Bandwidth App. |
+**time** | **\DateTime** | |
+**segment_count** | **int** | The number of segments the user's message is broken into before sending over carrier networks. |
+**direction** | [**\Bandwidth\Model\MessageDirectionEnum**](MessageDirectionEnum.md) | |
+**to** | **string[]** | The phone number recipients of the message. |
+**from** | **string** | The Bandwidth phone number or alphanumeric identifier the message was sent from. |
+**text** | **string** | | [optional]
+**tag** | **string** | A custom string that will be included in callback events of the message. Max 1024 characters. | [optional]
+**media** | **string[]** | Optional media, not applicable for sms | [optional]
+**priority** | [**\Bandwidth\Model\PriorityEnum**](PriorityEnum.md) | | [optional]
+**channel** | [**\Bandwidth\Model\MultiChannelMessageChannelEnum**](MultiChannelMessageChannelEnum.md) | | [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/StatusCallbackTypeEnum.md b/docs/Model/StatusCallbackTypeEnum.md
new file mode 100644
index 0000000..a16be06
--- /dev/null
+++ b/docs/Model/StatusCallbackTypeEnum.md
@@ -0,0 +1,8 @@
+# StatusCallbackTypeEnum
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+
+[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
diff --git a/docs/Model/StirShaken.md b/docs/Model/StirShaken.md
new file mode 100644
index 0000000..1023b2a
--- /dev/null
+++ b/docs/Model/StirShaken.md
@@ -0,0 +1,11 @@
+# StirShaken
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**verstat** | **string** | (optional) The verification status indicating whether the verification was successful or not. Possible values are TN-Validation-Passed and TN-Validation-Failed. | [optional]
+**attestation_indicator** | **string** | (optional) The attestation level verified by Bandwidth. Possible values are A (full), B (partial) or C (gateway). | [optional]
+**originating_id** | **string** | (optional) A unique origination identifier. | [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/SyncLookupRequest.md b/docs/Model/SyncLookupRequest.md
new file mode 100644
index 0000000..bb75e91
--- /dev/null
+++ b/docs/Model/SyncLookupRequest.md
@@ -0,0 +1,10 @@
+# SyncLookupRequest
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**phone_numbers** | **string[]** | Telephone numbers in E.164 format. |
+**rcs_agent** | **string** | Override the default RCS sender/agent ID used when checking RCS capabilities. When provided, this value is used as the `sender` in the RCS capability-check request instead of the account default. Must be 1–40 characters and contain only letters, digits, underscores, or hyphens. | [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/TelephoneNumber.md b/docs/Model/TelephoneNumber.md
new file mode 100644
index 0000000..bb99ce0
--- /dev/null
+++ b/docs/Model/TelephoneNumber.md
@@ -0,0 +1,9 @@
+# TelephoneNumber
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**telephone_number** | **string** | Simple Telephone Number. | [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/TfvBasicAuthentication.md b/docs/Model/TfvBasicAuthentication.md
new file mode 100644
index 0000000..67a462e
--- /dev/null
+++ b/docs/Model/TfvBasicAuthentication.md
@@ -0,0 +1,10 @@
+# TfvBasicAuthentication
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**username** | **string** | |
+**password** | **string** | |
+
+[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
diff --git a/docs/Model/TfvCallbackStatusEnum.md b/docs/Model/TfvCallbackStatusEnum.md
new file mode 100644
index 0000000..7db3951
--- /dev/null
+++ b/docs/Model/TfvCallbackStatusEnum.md
@@ -0,0 +1,8 @@
+# TfvCallbackStatusEnum
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+
+[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
diff --git a/docs/Model/TfvError.md b/docs/Model/TfvError.md
new file mode 100644
index 0000000..c8b173d
--- /dev/null
+++ b/docs/Model/TfvError.md
@@ -0,0 +1,11 @@
+# TfvError
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**type** | **string** | | [optional]
+**description** | **string** | | [optional]
+**errors** | **object** | Each key of this errors object refers to a field of the submitted object (using dot notation for nested objects), with the field being a key to an array of one or more errors for that field. | [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/TfvStatus.md b/docs/Model/TfvStatus.md
new file mode 100644
index 0000000..1f1f9b6
--- /dev/null
+++ b/docs/Model/TfvStatus.md
@@ -0,0 +1,21 @@
+# TfvStatus
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**phone_number** | **string** | Toll-free telephone number in E.164 format. | [optional]
+**status** | [**\Bandwidth\Model\TfvStatusEnum**](TfvStatusEnum.md) | | [optional]
+**internal_ticket_number** | **string** | Unique identifier (UUID) generated by Bandwidth to assist in tracking the verification status of a toll-free number - included in all webhook payloads. | [optional]
+**decline_reason_description** | **string** | Explanation for why a verification request was declined. | [optional]
+**denial_status_code** | **int** | Reason code for denial. | [optional]
+**additional_denial_reasons** | [**\Bandwidth\Model\AdditionalDenialReason[]**](AdditionalDenialReason.md) | An optional list of denial reasons in addition to declineReasonDescription when multiple reasons apply. | [optional]
+**resubmit_allowed** | **bool** | Whether a Toll-Free Verification request qualifies for resubmission via PUT. | [optional]
+**created_date_time** | **\DateTime** | Date and time the verification request was created. | [optional]
+**modified_date_time** | **\DateTime** | Date and time the verification request was last modified. | [optional]
+**submission** | [**\Bandwidth\Model\TfvSubmissionInfo**](TfvSubmissionInfo.md) | | [optional]
+**blocked** | **bool** | Whether a Toll-Free Verification is blocked. This attribute will only be defined when the number is blocked. | [optional]
+**blocked_reason** | **string** | The reason why the Toll-Free Verification is blocked. This attribute will only be defined when the number is blocked. | [optional]
+**cv_token** | **string** | The token provided by Campaign Verify to validate your political use case. Only required for 527 political organizations. If you are not a 527 political organization, this field should be omitted. Supplying an empty string will likely result in rejection. | [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/TfvStatusEnum.md b/docs/Model/TfvStatusEnum.md
new file mode 100644
index 0000000..a7c720d
--- /dev/null
+++ b/docs/Model/TfvStatusEnum.md
@@ -0,0 +1,8 @@
+# TfvStatusEnum
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+
+[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
diff --git a/docs/Model/TfvSubmissionInfo.md b/docs/Model/TfvSubmissionInfo.md
new file mode 100644
index 0000000..baa36f2
--- /dev/null
+++ b/docs/Model/TfvSubmissionInfo.md
@@ -0,0 +1,24 @@
+# TfvSubmissionInfo
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**business_address** | [**\Bandwidth\Model\Address**](Address.md) | | [optional]
+**business_contact** | [**\Bandwidth\Model\Contact**](Contact.md) | | [optional]
+**message_volume** | **int** | Estimated monthly volume of messages from the toll-free number. | [optional]
+**use_case** | **string** | The category of the use case. | [optional]
+**use_case_summary** | **string** | A general idea of the use case and customer. | [optional]
+**production_message_content** | **string** | Example of message content. | [optional]
+**opt_in_workflow** | [**\Bandwidth\Model\OptInWorkflow**](OptInWorkflow.md) | | [optional]
+**additional_information** | **string** | Any additional information. | [optional]
+**isv_reseller** | **string** | ISV name. | [optional]
+**privacy_policy_url** | **string** | The Toll-Free Verification request privacy policy URL. | [optional]
+**terms_and_conditions_url** | **string** | The Toll-Free Verification request terms and conditions policy URL. | [optional]
+**business_dba** | **string** | The company 'Doing Business As'. | [optional]
+**business_registration_number** | **string** | Government-issued business identifying number. **Note: As of October 19th, 2026 this field will be required when `businessEntityType` is _not_ `SOLE_PROPRIETOR`. If this field is provided, `businessRegistrationType` and `businessRegistrationIssuingCountry` are also required.** | [optional]
+**business_registration_type** | [**\Bandwidth\Model\BusinessRegistrationTypeEnum**](BusinessRegistrationTypeEnum.md) | | [optional]
+**business_registration_issuing_country** | **string** | The country issuing the business registration in ISO-3166-1 alpha-3 format. Alpha-2 format is accepted by the API, but alpha-3 is highly encouraged. **Note: As of October 19th, 2026 this field will be required when `businessRegistrationNumber` is provided.** | Registration Type | Supported Countries | |----------------------|------------------------------------| | EIN | USA | | CBN | CAN | | NEQ | CAN | | PROVINCIAL_NUMBER | CAN | | CRN | GBR, HKG | | VAT | GBR, IRL, BRA, NLD | | ACN | AUS | | ABN | AUS | | BRN | HKG | | SIREN | FRA | | SIRET | FRA | | NZBN | NZL | | UST_IDNR | DEU | | CIF | ESP | | NIF | ESP | | CNPJ | BRA | | UID | CHE | | OTHER | Must Provide Country Code | | [optional]
+**business_entity_type** | [**\Bandwidth\Model\BusinessEntityTypeEnum**](BusinessEntityTypeEnum.md) | | [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/TfvSubmissionWrapper.md b/docs/Model/TfvSubmissionWrapper.md
new file mode 100644
index 0000000..e295940
--- /dev/null
+++ b/docs/Model/TfvSubmissionWrapper.md
@@ -0,0 +1,9 @@
+# TfvSubmissionWrapper
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**submission** | [**\Bandwidth\Model\VerificationUpdateRequest**](VerificationUpdateRequest.md) | | [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/ThumbnailAlignmentEnum.md b/docs/Model/ThumbnailAlignmentEnum.md
new file mode 100644
index 0000000..e56d820
--- /dev/null
+++ b/docs/Model/ThumbnailAlignmentEnum.md
@@ -0,0 +1,8 @@
+# ThumbnailAlignmentEnum
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+
+[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
diff --git a/docs/Model/TranscribeRecording.md b/docs/Model/TranscribeRecording.md
new file mode 100644
index 0000000..1018548
--- /dev/null
+++ b/docs/Model/TranscribeRecording.md
@@ -0,0 +1,15 @@
+# TranscribeRecording
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**callback_url** | **string** | The URL to send the [TranscriptionAvailable](/docs/voice/webhooks/transcriptionAvailable) event to. You should not include sensitive or personally-identifiable information in the callbackUrl field! Always use the proper username and password fields for authorization. | [optional]
+**callback_method** | [**\Bandwidth\Model\CallbackMethodEnum**](CallbackMethodEnum.md) | | [optional]
+**username** | **string** | Basic auth username. | [optional]
+**password** | **string** | Basic auth password. | [optional]
+**tag** | **string** | (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present. | [optional]
+**callback_timeout** | **float** | This is the timeout (in seconds) to use when delivering the webhook to `callbackUrl`. Can be any numeric value (including decimals) between 1 and 25. | [optional] [default to 15]
+**detect_language** | **bool** | A boolean value to indicate that the recording may not be in English, and the transcription service will need to detect the dominant language the recording is in and transcribe accordingly. Current supported languages are English, French, and Spanish. | [optional] [default to false]
+
+[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
diff --git a/docs/Model/Transcription.md b/docs/Model/Transcription.md
new file mode 100644
index 0000000..c341d5d
--- /dev/null
+++ b/docs/Model/Transcription.md
@@ -0,0 +1,11 @@
+# Transcription
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**speaker** | **int** | Zero-based index identifying the speaker. | [optional]
+**text** | **string** | The transcribed text | [optional]
+**confidence** | **float** | The confidence on the recognized content, ranging from `0.0` to `1.0` with `1.0` being the highest confidence. | [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/TranscriptionAvailableCallback.md b/docs/Model/TranscriptionAvailableCallback.md
new file mode 100644
index 0000000..970b971
--- /dev/null
+++ b/docs/Model/TranscriptionAvailableCallback.md
@@ -0,0 +1,29 @@
+# TranscriptionAvailableCallback
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**event_type** | **string** | The event type, value can be one of the following: answer, bridgeComplete, bridgeTargetComplete, conferenceCreated, conferenceRedirect, conferenceMemberJoin, conferenceMemberExit, conferenceCompleted, conferenceRecordingAvailable, disconnect, dtmf, gather, initiate, machineDetectionComplete, recordingComplete, recordingAvailable, redirect, transcriptionAvailable, transferAnswer, transferComplete, transferDisconnect. | [optional]
+**event_time** | **\DateTime** | The approximate UTC date and time when the event was generated by the Bandwidth server, in ISO 8601 format. This may not be exactly the time of event execution. | [optional]
+**account_id** | **string** | The user account associated with the call. | [optional]
+**application_id** | **string** | The id of the application associated with the call. | [optional]
+**from** | **string** | The provided identifier of the caller. Must be a phone number in E.164 format (e.g. +15555555555). | [optional]
+**to** | **string** | The phone number that received the call, in E.164 format (e.g. +15555555555). | [optional]
+**direction** | [**\Bandwidth\Model\CallDirectionEnum**](CallDirectionEnum.md) | | [optional]
+**call_id** | **string** | The call id associated with the event. | [optional]
+**call_url** | **string** | The URL of the call associated with the event. | [optional]
+**media_url** | **string** | The URL that can be used to download the recording. Only present if the recording is finished and may be downloaded. | [optional]
+**parent_call_id** | **string** | (optional) If the event is related to the B leg of a <Transfer>, the call id of the original call leg that executed the <Transfer>. Otherwise, this field will not be present. | [optional]
+**recording_id** | **string** | The unique ID of this recording | [optional]
+**enqueued_time** | **\DateTime** | (optional) If call queueing is enabled and this is an outbound call, time the call was queued, in ISO 8601 format. | [optional]
+**start_time** | **\DateTime** | Time the call was started, in ISO 8601 format. | [optional]
+**end_time** | **\DateTime** | The time that the recording ended in ISO-8601 format | [optional]
+**duration** | **string** | The duration of the recording in ISO-8601 format | [optional]
+**file_format** | [**\Bandwidth\Model\FileFormatEnum**](FileFormatEnum.md) | | [optional]
+**tag** | **string** | (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present. | [optional]
+**transcription** | [**\Bandwidth\Model\Transcription**](Transcription.md) | | [optional]
+**transfer_caller_id** | **string** | The phone number used as the from field of the B-leg call, in E.164 format (e.g. +15555555555). | [optional]
+**transfer_to** | **string** | The phone number used as the to field of the B-leg call, in E.164 format (e.g. +15555555555). | [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/TransferAnswerCallback.md b/docs/Model/TransferAnswerCallback.md
new file mode 100644
index 0000000..c90ebdd
--- /dev/null
+++ b/docs/Model/TransferAnswerCallback.md
@@ -0,0 +1,23 @@
+# TransferAnswerCallback
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**event_type** | **string** | The event type, value can be one of the following: answer, bridgeComplete, bridgeTargetComplete, conferenceCreated, conferenceRedirect, conferenceMemberJoin, conferenceMemberExit, conferenceCompleted, conferenceRecordingAvailable, disconnect, dtmf, gather, initiate, machineDetectionComplete, recordingComplete, recordingAvailable, redirect, transcriptionAvailable, transferAnswer, transferComplete, transferDisconnect. | [optional]
+**event_time** | **\DateTime** | The approximate UTC date and time when the event was generated by the Bandwidth server, in ISO 8601 format. This may not be exactly the time of event execution. | [optional]
+**account_id** | **string** | The user account associated with the call. | [optional]
+**application_id** | **string** | The id of the application associated with the call. | [optional]
+**from** | **string** | The provided identifier of the caller. Must be a phone number in E.164 format (e.g. +15555555555). | [optional]
+**to** | **string** | The phone number that received the call, in E.164 format (e.g. +15555555555). | [optional]
+**direction** | [**\Bandwidth\Model\CallDirectionEnum**](CallDirectionEnum.md) | | [optional]
+**call_id** | **string** | The call id associated with the event. | [optional]
+**call_url** | **string** | The URL of the call associated with the event. | [optional]
+**enqueued_time** | **\DateTime** | (optional) If call queueing is enabled and this is an outbound call, time the call was queued, in ISO 8601 format. | [optional]
+**start_time** | **\DateTime** | Time the call was started, in ISO 8601 format. | [optional]
+**answer_time** | **\DateTime** | Time the call was answered, in ISO 8601 format. | [optional]
+**tag** | **string** | (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present. | [optional]
+**transfer_caller_id** | **string** | The phone number used as the from field of the B-leg call, in E.164 format (e.g. +15555555555). | [optional]
+**transfer_to** | **string** | The phone number used as the to field of the B-leg call, in E.164 format (e.g. +15555555555). | [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/TransferCompleteCallback.md b/docs/Model/TransferCompleteCallback.md
new file mode 100644
index 0000000..826e130
--- /dev/null
+++ b/docs/Model/TransferCompleteCallback.md
@@ -0,0 +1,26 @@
+# TransferCompleteCallback
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**event_type** | **string** | The event type, value can be one of the following: answer, bridgeComplete, bridgeTargetComplete, conferenceCreated, conferenceRedirect, conferenceMemberJoin, conferenceMemberExit, conferenceCompleted, conferenceRecordingAvailable, disconnect, dtmf, gather, initiate, machineDetectionComplete, recordingComplete, recordingAvailable, redirect, transcriptionAvailable, transferAnswer, transferComplete, transferDisconnect. | [optional]
+**event_time** | **\DateTime** | The approximate UTC date and time when the event was generated by the Bandwidth server, in ISO 8601 format. This may not be exactly the time of event execution. | [optional]
+**account_id** | **string** | The user account associated with the call. | [optional]
+**application_id** | **string** | The id of the application associated with the call. | [optional]
+**from** | **string** | The provided identifier of the caller. Must be a phone number in E.164 format (e.g. +15555555555). | [optional]
+**to** | **string** | The phone number that received the call, in E.164 format (e.g. +15555555555). | [optional]
+**direction** | [**\Bandwidth\Model\CallDirectionEnum**](CallDirectionEnum.md) | | [optional]
+**call_id** | **string** | The call id associated with the event. | [optional]
+**call_url** | **string** | The URL of the call associated with the event. | [optional]
+**enqueued_time** | **\DateTime** | (optional) If call queueing is enabled and this is an outbound call, time the call was queued, in ISO 8601 format. | [optional]
+**start_time** | **\DateTime** | Time the call was started, in ISO 8601 format. | [optional]
+**answer_time** | **\DateTime** | Time the call was answered, in ISO 8601 format. | [optional]
+**tag** | **string** | (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present. | [optional]
+**transfer_caller_id** | **string** | The phone number used as the from field of the B-leg call, in E.164 format (e.g. +15555555555). | [optional]
+**transfer_to** | **string** | The phone number used as the to field of the B-leg call, in E.164 format (e.g. +15555555555). | [optional]
+**cause** | **string** | Reason the call failed - hangup, busy, timeout, cancel, rejected, callback-error, invalid-bxml, application-error, account-limit, node-capacity-exceeded, error, or unknown. | [optional]
+**error_message** | **string** | Text explaining the reason that caused the call to fail in case of errors. | [optional]
+**error_id** | **string** | Bandwidth's internal id that references the error event. | [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/TransferDisconnectCallback.md b/docs/Model/TransferDisconnectCallback.md
new file mode 100644
index 0000000..92067a2
--- /dev/null
+++ b/docs/Model/TransferDisconnectCallback.md
@@ -0,0 +1,28 @@
+# TransferDisconnectCallback
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**event_type** | **string** | The event type, value can be one of the following: answer, bridgeComplete, bridgeTargetComplete, conferenceCreated, conferenceRedirect, conferenceMemberJoin, conferenceMemberExit, conferenceCompleted, conferenceRecordingAvailable, disconnect, dtmf, gather, initiate, machineDetectionComplete, recordingComplete, recordingAvailable, redirect, transcriptionAvailable, transferAnswer, transferComplete, transferDisconnect. | [optional]
+**event_time** | **\DateTime** | The approximate UTC date and time when the event was generated by the Bandwidth server, in ISO 8601 format. This may not be exactly the time of event execution. | [optional]
+**account_id** | **string** | The user account associated with the call. | [optional]
+**application_id** | **string** | The id of the application associated with the call. | [optional]
+**from** | **string** | The provided identifier of the caller. Must be a phone number in E.164 format (e.g. +15555555555). | [optional]
+**to** | **string** | The phone number that received the call, in E.164 format (e.g. +15555555555). | [optional]
+**direction** | [**\Bandwidth\Model\CallDirectionEnum**](CallDirectionEnum.md) | | [optional]
+**call_id** | **string** | The call id associated with the event. | [optional]
+**call_url** | **string** | The URL of the call associated with the event. | [optional]
+**parent_call_id** | **string** | (optional) If the event is related to the B leg of a <Transfer>, the call id of the original call leg that executed the <Transfer>. Otherwise, this field will not be present. | [optional]
+**enqueued_time** | **\DateTime** | (optional) If call queueing is enabled and this is an outbound call, time the call was queued, in ISO 8601 format. | [optional]
+**start_time** | **\DateTime** | Time the call was started, in ISO 8601 format. | [optional]
+**answer_time** | **\DateTime** | Time the call was answered, in ISO 8601 format. | [optional]
+**end_time** | **\DateTime** | The time that the recording ended in ISO-8601 format | [optional]
+**tag** | **string** | (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present. | [optional]
+**transfer_caller_id** | **string** | The phone number used as the from field of the B-leg call, in E.164 format (e.g. +15555555555). | [optional]
+**transfer_to** | **string** | The phone number used as the to field of the B-leg call, in E.164 format (e.g. +15555555555). | [optional]
+**cause** | **string** | Reason the call failed - hangup, busy, timeout, cancel, rejected, callback-error, invalid-bxml, application-error, account-limit, node-capacity-exceeded, error, or unknown. | [optional]
+**error_message** | **string** | Text explaining the reason that caused the call to fail in case of errors. | [optional]
+**error_id** | **string** | Bandwidth's internal id that references the error event. | [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/UpdateCall.md b/docs/Model/UpdateCall.md
new file mode 100644
index 0000000..f3bdf8d
--- /dev/null
+++ b/docs/Model/UpdateCall.md
@@ -0,0 +1,18 @@
+# UpdateCall
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**state** | [**\Bandwidth\Model\CallStateEnum**](CallStateEnum.md) | | [optional]
+**redirect_url** | **string** | The URL to send the [Redirect](/docs/voice/bxml/redirect) event to which will provide new BXML. Required if `state` is `active`. Not allowed if `state` is `completed`. | [optional]
+**redirect_method** | [**\Bandwidth\Model\RedirectMethodEnum**](RedirectMethodEnum.md) | | [optional]
+**username** | **string** | Basic auth username. | [optional]
+**password** | **string** | Basic auth password. | [optional]
+**redirect_fallback_url** | **string** | A fallback url which, if provided, will be used to retry the redirect callback delivery in case `redirectUrl` fails to respond. | [optional]
+**redirect_fallback_method** | [**\Bandwidth\Model\RedirectMethodEnum**](RedirectMethodEnum.md) | | [optional]
+**fallback_username** | **string** | Basic auth username. | [optional]
+**fallback_password** | **string** | Basic auth password. | [optional]
+**tag** | **string** | A custom string that will be sent with this and all future callbacks unless overwritten by a future `tag` attribute or [`<Tag>`](/docs/voice/bxml/tag) verb, or cleared. May be cleared by setting `tag=\"\"`. Max length 4096 characters. Not allowed if `state` is `completed`. | [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/UpdateCallRecording.md b/docs/Model/UpdateCallRecording.md
new file mode 100644
index 0000000..e96fa5e
--- /dev/null
+++ b/docs/Model/UpdateCallRecording.md
@@ -0,0 +1,9 @@
+# UpdateCallRecording
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**state** | [**\Bandwidth\Model\RecordingStateEnum**](RecordingStateEnum.md) | |
+
+[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
diff --git a/docs/Model/UpdateConference.md b/docs/Model/UpdateConference.md
new file mode 100644
index 0000000..3754850
--- /dev/null
+++ b/docs/Model/UpdateConference.md
@@ -0,0 +1,17 @@
+# UpdateConference
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**status** | [**\Bandwidth\Model\ConferenceStateEnum**](ConferenceStateEnum.md) | | [optional]
+**redirect_url** | **string** | The URL to send the [conferenceRedirect](/docs/voice/webhooks/conferenceRedirect) event which will provide new BXML. Not allowed if `state` is `completed`, but required if `state` is `active`. | [optional]
+**redirect_method** | [**\Bandwidth\Model\RedirectMethodEnum**](RedirectMethodEnum.md) | | [optional]
+**username** | **string** | Basic auth username. | [optional]
+**password** | **string** | Basic auth password. | [optional]
+**redirect_fallback_url** | **string** | A fallback url which, if provided, will be used to retry the `conferenceRedirect` webhook delivery in case `redirectUrl` fails to respond. Not allowed if `state` is `completed`. | [optional]
+**redirect_fallback_method** | [**\Bandwidth\Model\RedirectMethodEnum**](RedirectMethodEnum.md) | | [optional]
+**fallback_username** | **string** | Basic auth username. | [optional]
+**fallback_password** | **string** | Basic auth password. | [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/UpdateConferenceMember.md b/docs/Model/UpdateConferenceMember.md
new file mode 100644
index 0000000..a21b003
--- /dev/null
+++ b/docs/Model/UpdateConferenceMember.md
@@ -0,0 +1,11 @@
+# UpdateConferenceMember
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**mute** | **bool** | Whether or not this member is currently muted. Members who are muted are still able to hear other participants. Updates this member's mute status. Has no effect if omitted. | [optional]
+**hold** | **bool** | Whether or not this member is currently on hold. Members who are on hold are not able to hear or speak in the conference. Updates this member's hold status. Has no effect if omitted. | [optional]
+**call_ids_to_coach** | **string[]** | If this member had a value set for `callIdsToCoach` in its [Conference](/docs/voice/bxml/conference) verb or this list was added with a previous PUT request to modify the member, this is that list of calls. Modifies the calls that this member is coaching. Has no effect if omitted. See the documentation for the [Conference](/docs/voice/bxml/conference) verb for more details about coaching. Note that this will not add the matching calls to the conference; each call must individually execute a Conference verb to join. | [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/VerificationDenialWebhook.md b/docs/Model/VerificationDenialWebhook.md
new file mode 100644
index 0000000..a2dadad
--- /dev/null
+++ b/docs/Model/VerificationDenialWebhook.md
@@ -0,0 +1,18 @@
+# VerificationDenialWebhook
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**account_id** | **string** | User's account ID. | [optional]
+**additional_denial_reasons** | [**\Bandwidth\Model\AdditionalDenialReason[]**](AdditionalDenialReason.md) | An optional list of denial reasons in addition to declineReasonDescription when multiple reasons apply. | [optional]
+**decline_reason_description** | **string** | Explanation for why a verification request was declined. | [optional]
+**denial_status_code** | **int** | Reason code for denial. | [optional]
+**internal_ticket_number** | **string** | Unique identifier (UUID) generated by Bandwidth to assist in tracking the verification status of a toll-free number. | [optional]
+**phone_number** | **string** | Toll-free telephone number in E.164 format. | [optional]
+**resubmit_allowed** | **bool** | Whether a Toll-Free Verification request qualifies for resubmission via PUT. | [optional]
+**status** | **string** | | [optional] [default to 'UNVERIFIED']
+**blocked** | **bool** | Whether a Toll-Free Verification is blocked. This attribute will only be defined when the number is blocked. | [optional]
+**blocked_reason** | **string** | The reason why the Toll-Free Verification is blocked. This attribute will only be defined when the number is blocked. | [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/VerificationRequest.md b/docs/Model/VerificationRequest.md
new file mode 100644
index 0000000..cd5dcf6
--- /dev/null
+++ b/docs/Model/VerificationRequest.md
@@ -0,0 +1,28 @@
+# VerificationRequest
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**business_address** | [**\Bandwidth\Model\Address**](Address.md) | |
+**business_contact** | [**\Bandwidth\Model\Contact**](Contact.md) | |
+**message_volume** | **int** | Estimated monthly volume of messages from the toll-free number. |
+**phone_numbers** | **string[]** | |
+**use_case** | **string** | The category of the use case. |
+**use_case_summary** | **string** | A general idea of the use case and customer. |
+**production_message_content** | **string** | Example of message content. |
+**opt_in_workflow** | [**\Bandwidth\Model\OptInWorkflow**](OptInWorkflow.md) | |
+**additional_information** | **string** | Any additional information. | [optional]
+**isv_reseller** | **string** | ISV name. | [optional]
+**privacy_policy_url** | **string** | The Toll-Free Verification request privacy policy URL. | [optional]
+**terms_and_conditions_url** | **string** | The Toll-Free Verification request terms and conditions policy URL. | [optional]
+**business_dba** | **string** | The company 'Doing Business As'. | [optional]
+**business_registration_number** | **string** | Government-issued business identifying number. **Note: As of October 19th, 2026 this field will be required when `businessEntityType` is _not_ `SOLE_PROPRIETOR`. If this field is provided, `businessRegistrationType` and `businessRegistrationIssuingCountry` are also required.** | [optional]
+**business_registration_type** | [**\Bandwidth\Model\BusinessRegistrationTypeEnum**](BusinessRegistrationTypeEnum.md) | | [optional]
+**business_registration_issuing_country** | **string** | The country issuing the business registration in ISO-3166-1 alpha-3 format. Alpha-2 format is accepted by the API, but alpha-3 is highly encouraged. **Note: As of October 19th, 2026 this field will be required when `businessRegistrationNumber` is provided.** | Registration Type | Supported Countries | |----------------------|------------------------------------| | EIN | USA | | CBN | CAN | | NEQ | CAN | | PROVINCIAL_NUMBER | CAN | | CRN | GBR, HKG | | VAT | GBR, IRL, BRA, NLD | | ACN | AUS | | ABN | AUS | | BRN | HKG | | SIREN | FRA | | SIRET | FRA | | NZBN | NZL | | UST_IDNR | DEU | | CIF | ESP | | NIF | ESP | | CNPJ | BRA | | UID | CHE | | OTHER | Must Provide Country Code | | [optional]
+**business_entity_type** | [**\Bandwidth\Model\BusinessEntityTypeEnum**](BusinessEntityTypeEnum.md) | |
+**help_message_response** | **string** | A message that gets sent to users requesting help. | [optional]
+**age_gated_content** | **bool** | Indicates whether the content is age-gated. | [optional]
+**cv_token** | **string** | The token provided by Campaign Verify to validate your political use case. Only required for 527 political organizations. If you are not a 527 political organization, this field should be omitted. Supplying an empty string will likely result in rejection. | [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/VerificationUpdateRequest.md b/docs/Model/VerificationUpdateRequest.md
new file mode 100644
index 0000000..1d891fc
--- /dev/null
+++ b/docs/Model/VerificationUpdateRequest.md
@@ -0,0 +1,27 @@
+# VerificationUpdateRequest
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**business_address** | [**\Bandwidth\Model\Address**](Address.md) | |
+**business_contact** | [**\Bandwidth\Model\Contact**](Contact.md) | |
+**message_volume** | **int** | Estimated monthly volume of messages from the toll-free number. |
+**use_case** | **string** | The category of the use case. |
+**use_case_summary** | **string** | A general idea of the use case and customer. |
+**production_message_content** | **string** | Example of message content. |
+**opt_in_workflow** | [**\Bandwidth\Model\OptInWorkflow**](OptInWorkflow.md) | |
+**additional_information** | **string** | Any additional information. | [optional]
+**isv_reseller** | **string** | ISV name. | [optional]
+**privacy_policy_url** | **string** | The Toll-Free Verification request privacy policy URL. | [optional]
+**terms_and_conditions_url** | **string** | The Toll-Free Verification request terms and conditions policy URL. | [optional]
+**business_dba** | **string** | The company 'Doing Business As'. | [optional]
+**business_registration_number** | **string** | Government-issued business identifying number. **Note: As of October 19th, 2026 this field will be required when `businessEntityType` is _not_ `SOLE_PROPRIETOR`. If this field is provided, `businessRegistrationType` and `businessRegistrationIssuingCountry` are also required.** | [optional]
+**business_registration_type** | [**\Bandwidth\Model\BusinessRegistrationTypeEnum**](BusinessRegistrationTypeEnum.md) | | [optional]
+**business_entity_type** | [**\Bandwidth\Model\BusinessEntityTypeEnum**](BusinessEntityTypeEnum.md) | | [optional]
+**business_registration_issuing_country** | **string** | The country issuing the business registration in ISO-3166-1 alpha-3 format. Alpha-2 format is accepted by the API, but alpha-3 is highly encouraged. **Note: As of October 19th, 2026 this field will be required when `businessRegistrationNumber` is provided.** | Registration Type | Supported Countries | |----------------------|------------------------------------| | EIN | USA | | CBN | CAN | | NEQ | CAN | | PROVINCIAL_NUMBER | CAN | | CRN | GBR, HKG | | VAT | GBR, IRL, BRA, NLD | | ACN | AUS | | ABN | AUS | | BRN | HKG | | SIREN | FRA | | SIRET | FRA | | NZBN | NZL | | UST_IDNR | DEU | | CIF | ESP | | NIF | ESP | | CNPJ | BRA | | UID | CHE | | OTHER | Must Provide Country Code | | [optional]
+**help_message_response** | **string** | A message that gets sent to users requesting help. | [optional]
+**age_gated_content** | **bool** | Indicates whether the content is age-gated. | [optional]
+**cv_token** | **string** | The token provided by Campaign Verify to validate your political use case. Only required for 527 political organizations. If you are not a 527 political organization, this field should be omitted. Supplying an empty string will likely result in rejection. | [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/VerificationWebhook.md b/docs/Model/VerificationWebhook.md
new file mode 100644
index 0000000..1707174
--- /dev/null
+++ b/docs/Model/VerificationWebhook.md
@@ -0,0 +1,12 @@
+# VerificationWebhook
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**account_id** | **string** | User's account ID. | [optional]
+**phone_number** | **string** | Toll-free telephone number in E.164 format. | [optional]
+**status** | [**\Bandwidth\Model\TfvCallbackStatusEnum**](TfvCallbackStatusEnum.md) | | [optional]
+**internal_ticket_number** | **string** | Unique identifier (UUID) generated by Bandwidth to assist in tracking the verification status of a toll-free number. | [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/VerifyCodeRequest.md b/docs/Model/VerifyCodeRequest.md
new file mode 100644
index 0000000..5c70f91
--- /dev/null
+++ b/docs/Model/VerifyCodeRequest.md
@@ -0,0 +1,12 @@
+# VerifyCodeRequest
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**to** | **string** | The phone number to send the mfa code to. |
+**scope** | **string** | An optional field to denote what scope or action the mfa code is addressing. If not supplied, defaults to \"2FA\". | [optional]
+**expiration_time_in_minutes** | **float** | The time period, in minutes, to validate the mfa code. By setting this to 3 minutes, it will mean any code generated within the last 3 minutes are still valid. The valid range for expiration time is between 0 and 15 minutes, exclusively and inclusively, respectively. |
+**code** | **string** | The generated mfa code to check if valid. |
+
+[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
diff --git a/docs/Model/VerifyCodeResponse.md b/docs/Model/VerifyCodeResponse.md
new file mode 100644
index 0000000..9bd4f40
--- /dev/null
+++ b/docs/Model/VerifyCodeResponse.md
@@ -0,0 +1,9 @@
+# VerifyCodeResponse
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**valid** | **bool** | Whether or not the supplied code is valid. | [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/VoiceApiError.md b/docs/Model/VoiceApiError.md
new file mode 100644
index 0000000..68457be
--- /dev/null
+++ b/docs/Model/VoiceApiError.md
@@ -0,0 +1,11 @@
+# VoiceApiError
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**type** | **string** | | [optional]
+**description** | **string** | | [optional]
+**id** | **string** | | [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/VoiceCodeResponse.md b/docs/Model/VoiceCodeResponse.md
new file mode 100644
index 0000000..7810c41
--- /dev/null
+++ b/docs/Model/VoiceCodeResponse.md
@@ -0,0 +1,9 @@
+# VoiceCodeResponse
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**call_id** | **string** | Programmable Voice API Call ID. | [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/WebhookSubscription.md b/docs/Model/WebhookSubscription.md
new file mode 100644
index 0000000..73d9a1f
--- /dev/null
+++ b/docs/Model/WebhookSubscription.md
@@ -0,0 +1,15 @@
+# WebhookSubscription
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**id** | **string** | | [optional]
+**account_id** | **string** | | [optional]
+**callback_url** | **string** | Callback URL to receive status updates from Bandwidth. When a webhook subscription is registered with Bandwidth under a given account ID, it will be used to send status updates for all requests submitted under that account ID. |
+**type** | [**\Bandwidth\Model\WebhookSubscriptionTypeEnum**](WebhookSubscriptionTypeEnum.md) | | [optional]
+**basic_authentication** | [**\Bandwidth\Model\WebhookSubscriptionBasicAuthentication**](WebhookSubscriptionBasicAuthentication.md) | | [optional]
+**created_date** | **\DateTime** | | [optional]
+**modified_date** | **\DateTime** | | [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/WebhookSubscriptionBasicAuthentication.md b/docs/Model/WebhookSubscriptionBasicAuthentication.md
new file mode 100644
index 0000000..da07487
--- /dev/null
+++ b/docs/Model/WebhookSubscriptionBasicAuthentication.md
@@ -0,0 +1,10 @@
+# WebhookSubscriptionBasicAuthentication
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**username** | **string** | |
+**password** | **string** | |
+
+[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
diff --git a/docs/Model/WebhookSubscriptionError.md b/docs/Model/WebhookSubscriptionError.md
new file mode 100644
index 0000000..7879abc
--- /dev/null
+++ b/docs/Model/WebhookSubscriptionError.md
@@ -0,0 +1,11 @@
+# WebhookSubscriptionError
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**code** | **int** | | [optional]
+**description** | **string** | | [optional]
+**telephone_numbers** | [**\Bandwidth\Model\TelephoneNumber[]**](TelephoneNumber.md) | | [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/WebhookSubscriptionRequestSchema.md b/docs/Model/WebhookSubscriptionRequestSchema.md
new file mode 100644
index 0000000..075d329
--- /dev/null
+++ b/docs/Model/WebhookSubscriptionRequestSchema.md
@@ -0,0 +1,11 @@
+# WebhookSubscriptionRequestSchema
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**basic_authentication** | [**\Bandwidth\Model\TfvBasicAuthentication**](TfvBasicAuthentication.md) | | [optional]
+**callback_url** | **string** | Callback URL to receive status updates from Bandwidth. When a webhook subscription is registered with Bandwidth under a given account ID, it will be used to send status updates for all requests submitted under that account ID. |
+**shared_secret_key** | **string** | An ASCII string submitted by the user as a shared secret key for generating an HMAC header for 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/WebhookSubscriptionTypeEnum.md b/docs/Model/WebhookSubscriptionTypeEnum.md
new file mode 100644
index 0000000..5faaf40
--- /dev/null
+++ b/docs/Model/WebhookSubscriptionTypeEnum.md
@@ -0,0 +1,8 @@
+# WebhookSubscriptionTypeEnum
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+
+[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
diff --git a/docs/Model/WebhookSubscriptionsListBody.md b/docs/Model/WebhookSubscriptionsListBody.md
new file mode 100644
index 0000000..d7c4f52
--- /dev/null
+++ b/docs/Model/WebhookSubscriptionsListBody.md
@@ -0,0 +1,11 @@
+# WebhookSubscriptionsListBody
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**links** | [**\Bandwidth\Model\LinksObject**](LinksObject.md) | | [optional]
+**errors** | [**\Bandwidth\Model\WebhookSubscriptionError[]**](WebhookSubscriptionError.md) | | [optional]
+**data** | [**\Bandwidth\Model\WebhookSubscription[]**](WebhookSubscription.md) | |
+
+[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
diff --git a/git_push.sh b/git_push.sh
new file mode 100644
index 0000000..b15db01
--- /dev/null
+++ b/git_push.sh
@@ -0,0 +1,57 @@
+#!/bin/sh
+# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
+#
+# Usage example: /bin/sh ./git_push.sh wing328 openapi-petstore-perl "minor update" "gitlab.com"
+
+git_user_id=$1
+git_repo_id=$2
+release_note=$3
+git_host=$4
+
+if [ "$git_host" = "" ]; then
+ git_host="github.com"
+ echo "[INFO] No command line input provided. Set \$git_host to $git_host"
+fi
+
+if [ "$git_user_id" = "" ]; then
+ git_user_id="bandwidth"
+ echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id"
+fi
+
+if [ "$git_repo_id" = "" ]; then
+ git_repo_id="php-sdk"
+ echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id"
+fi
+
+if [ "$release_note" = "" ]; then
+ release_note="Minor update"
+ echo "[INFO] No command line input provided. Set \$release_note to $release_note"
+fi
+
+# Initialize the local directory as a Git repository
+git init
+
+# Adds the files in the local repository and stages them for commit.
+git add .
+
+# Commits the tracked changes and prepares them to be pushed to a remote repository.
+git commit -m "$release_note"
+
+# Sets the new remote
+git_remote=$(git remote)
+if [ "$git_remote" = "" ]; then # git remote not defined
+
+ if [ "$GIT_TOKEN" = "" ]; then
+ echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
+ git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git
+ else
+ git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@${git_host}/${git_user_id}/${git_repo_id}.git
+ fi
+
+fi
+
+git pull origin master
+
+# Pushes (Forces) the changes in the local repository up to the remote repository
+echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git"
+git push origin master 2>&1 | grep -v 'To https'
diff --git a/openapi-config.yml b/openapi-config.yml
new file mode 100644
index 0000000..b566853
--- /dev/null
+++ b/openapi-config.yml
@@ -0,0 +1,6 @@
+packageName: Bandwidth SDK
+composerPackageName: bandwidth/sdk
+invokerPackage: Bandwidth
+gitUserId: bandwidth
+gitRepoId: php-sdk
+templateDir: custom_templates
diff --git a/openapitools.json b/openapitools.json
new file mode 100644
index 0000000..f3237ad
--- /dev/null
+++ b/openapitools.json
@@ -0,0 +1,7 @@
+{
+ "$schema": "./node_modules/@openapitools/openapi-generator-cli/config.schema.json",
+ "spaces": 2,
+ "generator-cli": {
+ "version": "7.23.0"
+ }
+}
diff --git a/phpunit.xml b/phpunit.xml
deleted file mode 100644
index 5bdcd15..0000000
--- a/phpunit.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
-
- ./tests
-
-
-
diff --git a/phpunit.xml.dist b/phpunit.xml.dist
new file mode 100644
index 0000000..1135449
--- /dev/null
+++ b/phpunit.xml.dist
@@ -0,0 +1,18 @@
+
+
+
+
+ ./src/Api
+ ./src/Model
+
+
+
+
+ ./tests/Api
+ ./tests/Model
+
+
+
+
+
+
diff --git a/src/APIException.php b/src/APIException.php
index 55ae203..9de7508 100644
--- a/src/APIException.php
+++ b/src/APIException.php
@@ -1,86 +1,119 @@
getResponse()->getStatusCode());
- $this->context = $context;
- $this->errorMessage = $reason;
-
- if (static::class !== 'BandwidthLib\APIException') {
- $this->unbox();
- }
-
- }
+ protected mixed $responseObject = null;
/**
- * Unbox response into this exception class
+ * Constructor
+ *
+ * @param string $message Error message
+ * @param int $code HTTP status code
+ * @param string[][]|null $responseHeaders HTTP response header
+ * @param stdClass|string|null $responseBody HTTP decoded body of the server response either as stdClass or string
*/
- public function unbox()
+ public function __construct(string $message = "", int $code = 0, ?array $responseHeaders = [], stdClass|string|null $responseBody = null)
{
+ parent::__construct($message, $code);
+ $this->responseHeaders = $responseHeaders;
+ $this->responseBody = $responseBody;
}
/**
- * The HTTP context from the API request
- * @return \BandwidthLib\Http\HttpContext
+ * Gets the HTTP response header
+ *
+ * @return string[][]|null HTTP response header
*/
- public function getContext()
+ public function getResponseHeaders(): ?array
{
- return $this->context;
+ return $this->responseHeaders;
}
/**
- * The HTTP response code from the API request
- * @return int
+ * Gets the HTTP body of the server response either as Json or string
+ *
+ * @return stdClass|string|null HTTP body of the server response either as \stdClass or string
*/
- public function getResponseCode()
+ public function getResponseBody(): stdClass|string|null
{
- return $this->context->getResponse()->getStatusCode();
+ return $this->responseBody;
}
/**
- * The HTTP response body from the API request
- * @return mixed
+ * Sets the deserialized response object (during deserialization)
+ *
+ * @param mixed $obj Deserialized response object
+ *
+ * @return void
*/
- public function getResponseBody()
+ public function setResponseObject(mixed $obj): void
{
- return $this->context->getResponse()->getRawBody();
+ $this->responseObject = $obj;
}
/**
- * The reason for raising an exception
- * @return string
+ * Gets the deserialized response object (during deserialization)
+ *
+ * @return mixed the deserialized response object
*/
- public function getReason()
+ public function getResponseObject(): mixed
{
- return $this->message;
+ return $this->responseObject;
}
}
diff --git a/src/APIHelper.php b/src/APIHelper.php
deleted file mode 100644
index debe766..0000000
--- a/src/APIHelper.php
+++ /dev/null
@@ -1,172 +0,0 @@
- $value) {
- $replaceValue = '';
-
- //load parameter value
- if (is_null($value)) {
- $replaceValue = '';
- } elseif (is_array($value)) {
- $replaceValue = implode("/", array_map("urlencode", $value));
- } else {
- $val = strval($value);
- $replaceValue = $encode ? urlencode($val) : $val;
- }
-
- //find the template parameter and replace it with its value
- $url = str_replace('{' . strval($key) . '}', $replaceValue, $url);
- }
-
- return $url;
- }
-
- /**
- * Appends the given set of parameters to the given query string
- * @param string $queryBuilder The query url string to append the parameters
- * @param array $parameters The parameters to append
- * @return void
- */
- public static function appendUrlWithQueryParameters(string &$queryBuilder, array $parameters)
- {
- //perform parameter validation
- if (is_null($queryBuilder) || !is_string($queryBuilder)) {
- throw new InvalidArgumentException('Given value for parameter "queryBuilder" is invalid.');
- }
- if (is_null($parameters)) {
- return;
- }
- //does the query string already has parameters
- $hasParams = (strrpos($queryBuilder, '?') > 0);
-
- //if already has parameters, use the & to append new parameters
- $queryBuilder = $queryBuilder . (($hasParams) ? '&' : '?');
-
- //append parameters
- $queryBuilder = $queryBuilder . http_build_query($parameters);
- }
-
- /**
- * Validates and processes the given Url
- * @param string $url The given Url to process
- * @return string Pre-processed Url as string */
- public static function cleanUrl(string $url): string
- {
- //perform parameter validation
- if (is_null($url) || !is_string($url)) {
- throw new InvalidArgumentException('Invalid Url.');
- }
- //ensure that the urls are absolute
- $matchCount = preg_match("#^(https?://[^/]+)#", $url, $matches);
- if ($matchCount == 0) {
- throw new InvalidArgumentException('Invalid Url format.');
- }
- //get the http protocol match
- $protocol = $matches[1];
-
- //remove redundant forward slashes
- $query = substr($url, strlen($protocol));
- $query = preg_replace("#//+#", "/", $query);
-
- //return process url
- return $protocol.$query;
- }
-
- /**
- * Deserialize a Json string
- * @param string $json A valid Json string
- * @param mixed $instance Instance of an object to map the json into
- * @param boolean $isArray Is the Json an object array?
- * @return mixed Decoded Json
- */
- public static function deserialize(string $json, $instance = null, bool $isArray = false)
- {
- if ($instance == null) {
- return json_decode($json, true);
- } else {
- $mapper = new \apimatic\jsonmapper\JsonMapper();
- if ($isArray) {
- return $mapper->mapArray(json_decode($json), array(), $instance);
- } else {
- return $mapper->map(json_decode($json), $instance);
- }
- }
- }
-
- /**
- * Check if an array isAssociative (has string keys)
- * @param array $arr A valid array
- * @return boolean True if the array is Associative, false if it is Indexed
- */
- private static function isAssociative(array $arr): bool
- {
- foreach ($arr as $key => $value) {
- if (is_string($key)) {
- return true;
- }
- }
-
- return false;
- }
-
- /**
- * Prepare a model for form encoding
- * @param JsonSerializable $model A valid instance of JsonSerializable
- * @return array The model as a map of key value pairs
- */
- public static function prepareFormFields(JsonSerializable $model)
- {
- if (!$model instanceof JsonSerializable) {
- return $model;
- }
-
- $arr = $model->jsonSerialize();
-
- foreach ($arr as $key => $value) {
- if ($value instanceof JsonSerializable) {
- $arr[$key] = static::prepareFormFields($value);
- } elseif (is_array($value) && !empty($value) && !static::isAssociative($value) &&
- $value[0] instanceof JsonSerializable) {
- $temp = array();
- foreach ($value as $k => $v) {
- $temp[$k] = static::prepareFormFields($v);
- }
- $arr[$key] = $temp;
- }
- }
-
- return $arr;
- }
-}
diff --git a/src/Api/CallsApi.php b/src/Api/CallsApi.php
new file mode 100644
index 0000000..c1ffdfd
--- /dev/null
+++ b/src/Api/CallsApi.php
@@ -0,0 +1,2593 @@
+ $contentTypes **/
+ public const contentTypes = [
+ 'createCall' => [
+ 'application/json',
+ ],
+ 'getCallState' => [
+ 'application/json',
+ ],
+ 'listCalls' => [
+ 'application/json',
+ ],
+ 'updateCall' => [
+ 'application/json',
+ ],
+ 'updateCallBxml' => [
+ 'application/xml',
+ ],
+ ];
+
+ /**
+ * @param ClientInterface|null $client
+ * @param Configuration|null $config
+ * @param HeaderSelector|null $selector
+ * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec
+ */
+ public function __construct(
+ ?ClientInterface $client = null,
+ ?Configuration $config = null,
+ ?HeaderSelector $selector = null,
+ int $hostIndex = 0
+ ) {
+ $this->client = $client ?: new Client();
+ $this->config = $config ?: Configuration::getDefaultConfiguration();
+ $this->headerSelector = $selector ?: new HeaderSelector();
+ $this->hostIndex = $hostIndex;
+ }
+
+ /**
+ * Set the host index
+ *
+ * @param int $hostIndex Host index (required)
+ */
+ public function setHostIndex(int $hostIndex): void
+ {
+ $this->hostIndex = $hostIndex;
+ }
+
+ /**
+ * Get the host index
+ *
+ * @return int Host index
+ */
+ public function getHostIndex(): int
+ {
+ return $this->hostIndex;
+ }
+
+ /**
+ * @return Configuration
+ */
+ public function getConfig(): Configuration
+ {
+ return $this->config;
+ }
+
+ /**
+ * Operation createCall
+ *
+ * Create Call
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://voice.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param \Bandwidth\Model\CreateCall $create_call JSON object containing information to create an outbound call (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createCall'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return \Bandwidth\Model\CreateCallResponse|\Bandwidth\Model\VoiceApiError
+ */
+ public function createCall(
+ string $account_id,
+ \Bandwidth\Model\CreateCall $create_call,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['createCall'][0]
+ ): \Bandwidth\Model\CreateCallResponse|\Bandwidth\Model\VoiceApiError
+ {
+ list($response) = $this->createCallWithHttpInfo($account_id, $create_call, $hostIndex, $variables, $contentType);
+ return $response;
+ }
+
+ /**
+ * Operation createCallWithHttpInfo
+ *
+ * Create Call
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://voice.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param \Bandwidth\Model\CreateCall $create_call JSON object containing information to create an outbound call (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createCall'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return array{0: \Bandwidth\Model\CreateCallResponse|\Bandwidth\Model\VoiceApiError, 1: int, 2: array} [response data, HTTP status code, HTTP response headers]
+ */
+ public function createCallWithHttpInfo(
+ string $account_id,
+ \Bandwidth\Model\CreateCall $create_call,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['createCall'][0]
+ ): array
+ {
+ $request = $this->createCallRequest($account_id, $create_call, $hostIndex, $variables, $contentType);
+
+ try {
+ $options = $this->createHttpClientOption();
+ try {
+ $response = $this->client->send($request, $options);
+ } catch (RequestException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
+ $e->getResponse() ? (string) $e->getResponse()->getBody() : null
+ );
+ } catch (ConnectException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ null,
+ null
+ );
+ }
+
+ $statusCode = $response->getStatusCode();
+
+ switch($statusCode) {
+ case 201:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\CreateCallResponse',
+ $request,
+ $response,
+ );
+ case 400:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\VoiceApiError',
+ $request,
+ $response,
+ );
+ case 401:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\VoiceApiError',
+ $request,
+ $response,
+ );
+ case 403:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\VoiceApiError',
+ $request,
+ $response,
+ );
+ case 404:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\VoiceApiError',
+ $request,
+ $response,
+ );
+ case 405:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\VoiceApiError',
+ $request,
+ $response,
+ );
+ case 415:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\VoiceApiError',
+ $request,
+ $response,
+ );
+ case 429:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\VoiceApiError',
+ $request,
+ $response,
+ );
+ case 500:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\VoiceApiError',
+ $request,
+ $response,
+ );
+ }
+
+ if ($statusCode < 200 || $statusCode > 299) {
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ (string) $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\CreateCallResponse',
+ $request,
+ $response,
+ );
+ } catch (ApiException $e) {
+ switch ($e->getCode()) {
+ case 201:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\CreateCallResponse',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 400:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 401:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 403:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 404:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 405:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 415:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 429:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 500:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ }
+
+ throw $e;
+ }
+ }
+
+ /**
+ * Operation createCallAsync
+ *
+ * Create Call
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://voice.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param \Bandwidth\Model\CreateCall $create_call JSON object containing information to create an outbound call (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createCall'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function createCallAsync(
+ string $account_id,
+ \Bandwidth\Model\CreateCall $create_call,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['createCall'][0]
+ ): PromiseInterface
+ {
+ return $this->createCallAsyncWithHttpInfo($account_id, $create_call, $hostIndex, $variables, $contentType)
+ ->then(
+ function ($response) {
+ return $response[0];
+ }
+ );
+ }
+
+ /**
+ * Operation createCallAsyncWithHttpInfo
+ *
+ * Create Call
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://voice.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param \Bandwidth\Model\CreateCall $create_call JSON object containing information to create an outbound call (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createCall'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function createCallAsyncWithHttpInfo(
+ string $account_id,
+ \Bandwidth\Model\CreateCall $create_call,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['createCall'][0]
+ ): PromiseInterface
+ {
+ $returnType = '\Bandwidth\Model\CreateCallResponse';
+ $request = $this->createCallRequest($account_id, $create_call, $hostIndex, $variables, $contentType);
+
+ return $this->client
+ ->sendAsync($request, $this->createHttpClientOption())
+ ->then(
+ function ($response) use ($returnType) {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ },
+ function ($exception) {
+ $response = $exception->getResponse();
+ $statusCode = $response->getStatusCode();
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ $exception->getRequest()->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+ );
+ }
+
+ /**
+ * Create request for operation 'createCall'
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://voice.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param \Bandwidth\Model\CreateCall $create_call JSON object containing information to create an outbound call (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createCall'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return \GuzzleHttp\Psr7\Request
+ */
+ public function createCallRequest(
+ string $account_id,
+ \Bandwidth\Model\CreateCall $create_call,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['createCall'][0]
+ ): Request
+ {
+ // verify the required parameter 'account_id' is set
+ if ($account_id === null || (is_array($account_id) && count($account_id) === 0)) {
+ throw new InvalidArgumentException(
+ 'Missing the required parameter $account_id when calling createCall'
+ );
+ }
+ // verify the required parameter 'create_call' is set
+ if ($create_call === null || (is_array($create_call) && count($create_call) === 0)) {
+ throw new InvalidArgumentException(
+ 'Missing the required parameter $create_call when calling createCall'
+ );
+ }
+
+ $resourcePath = '/accounts/{accountId}/calls';
+ $formParams = [];
+ $queryParams = [];
+ $headerParams = [];
+ $httpBody = '';
+ $multipart = false;
+
+
+
+ // path params
+ if ($account_id !== null) {
+ $resourcePath = str_replace(
+ '{accountId}',
+ ObjectSerializer::toPathValue($account_id),
+ $resourcePath
+ );
+ }
+
+
+ $headers = $this->headerSelector->selectHeaders(
+ ['application/json', ],
+ $contentType,
+ $multipart
+ );
+
+ // for model (json/xml)
+ if (isset($create_call)) {
+ if (stripos($headers['Content-Type'], 'application/json') !== false) {
+ # if Content-Type contains "application/json", json_encode the body
+ $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($create_call));
+ } else {
+ $httpBody = $create_call;
+ }
+ } elseif (count($formParams) > 0) {
+ if ($multipart) {
+ $multipartContents = [];
+ foreach ($formParams as $formParamName => $formParamValue) {
+ $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
+ foreach ($formParamValueItems as $formParamValueItem) {
+ $multipartContents[] = [
+ 'name' => $formParamName,
+ 'contents' => $formParamValueItem
+ ];
+ }
+ }
+ // for HTTP post (form)
+ $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents);
+
+ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
+ # if Content-Type contains "application/json", json_encode the form parameters
+ $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams);
+ } else {
+ // for HTTP post (form)
+ $httpBody = ObjectSerializer::buildQuery($formParams);
+ }
+ }
+
+ // this endpoint requires HTTP basic authentication
+ if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) {
+ $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword());
+ }
+
+ // this endpoint requires OAuth (access token)
+ if (!empty($this->config->getAccessToken())) {
+ $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken();
+ }
+
+ $defaultHeaders = [];
+ if ($this->config->getUserAgent()) {
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
+ }
+
+ $headers = array_merge(
+ $defaultHeaders,
+ $headerParams,
+ $headers
+ );
+
+ if ($this->config->getIgnoreOperationHosts()) {
+ $operationHost = $this->config->getHost();
+ } else {
+ # Preserve the original behavior of server indexing.
+ if ($hostIndex === null) {
+ $hostIndex = $this->hostIndex;
+ }
+
+ $hostSettings = $this->getHostSettingsForcreateCall();
+
+ if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) {
+ throw new InvalidArgumentException("Invalid index {$hostIndex} when selecting the host. Must be less than ".count($hostSettings));
+ }
+ $operationHost = Configuration::getHostString($hostSettings, $hostIndex, $variables);
+ }
+ $query = ObjectSerializer::buildQuery($queryParams);
+ return new Request(
+ 'POST',
+ $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
+ $headers,
+ $httpBody
+ );
+ }
+
+ /**
+ * Returns an array of host settings for Operation createCall
+ *
+ * @return array an array of host settings
+ */
+ protected function getHostSettingsForcreateCall(): array
+ {
+ return [
+ [
+ "url" => "https://voice.bandwidth.com/api/v2",
+ "description" => "Production",
+ ]
+ ];
+ }
+
+ /**
+ * Operation getCallState
+ *
+ * Get Call State Information
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://voice.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $call_id Programmable Voice API Call ID. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getCallState'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return \Bandwidth\Model\CallState|\Bandwidth\Model\VoiceApiError
+ */
+ public function getCallState(
+ string $account_id,
+ string $call_id,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['getCallState'][0]
+ ): \Bandwidth\Model\CallState|\Bandwidth\Model\VoiceApiError
+ {
+ list($response) = $this->getCallStateWithHttpInfo($account_id, $call_id, $hostIndex, $variables, $contentType);
+ return $response;
+ }
+
+ /**
+ * Operation getCallStateWithHttpInfo
+ *
+ * Get Call State Information
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://voice.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $call_id Programmable Voice API Call ID. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getCallState'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return array{0: \Bandwidth\Model\CallState|\Bandwidth\Model\VoiceApiError, 1: int, 2: array} [response data, HTTP status code, HTTP response headers]
+ */
+ public function getCallStateWithHttpInfo(
+ string $account_id,
+ string $call_id,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['getCallState'][0]
+ ): array
+ {
+ $request = $this->getCallStateRequest($account_id, $call_id, $hostIndex, $variables, $contentType);
+
+ try {
+ $options = $this->createHttpClientOption();
+ try {
+ $response = $this->client->send($request, $options);
+ } catch (RequestException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
+ $e->getResponse() ? (string) $e->getResponse()->getBody() : null
+ );
+ } catch (ConnectException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ null,
+ null
+ );
+ }
+
+ $statusCode = $response->getStatusCode();
+
+ switch($statusCode) {
+ case 200:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\CallState',
+ $request,
+ $response,
+ );
+ case 400:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\VoiceApiError',
+ $request,
+ $response,
+ );
+ case 401:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\VoiceApiError',
+ $request,
+ $response,
+ );
+ case 403:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\VoiceApiError',
+ $request,
+ $response,
+ );
+ case 404:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\VoiceApiError',
+ $request,
+ $response,
+ );
+ case 405:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\VoiceApiError',
+ $request,
+ $response,
+ );
+ case 415:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\VoiceApiError',
+ $request,
+ $response,
+ );
+ case 429:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\VoiceApiError',
+ $request,
+ $response,
+ );
+ case 500:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\VoiceApiError',
+ $request,
+ $response,
+ );
+ }
+
+ if ($statusCode < 200 || $statusCode > 299) {
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ (string) $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\CallState',
+ $request,
+ $response,
+ );
+ } catch (ApiException $e) {
+ switch ($e->getCode()) {
+ case 200:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\CallState',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 400:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 401:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 403:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 404:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 405:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 415:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 429:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 500:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ }
+
+ throw $e;
+ }
+ }
+
+ /**
+ * Operation getCallStateAsync
+ *
+ * Get Call State Information
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://voice.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $call_id Programmable Voice API Call ID. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getCallState'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function getCallStateAsync(
+ string $account_id,
+ string $call_id,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['getCallState'][0]
+ ): PromiseInterface
+ {
+ return $this->getCallStateAsyncWithHttpInfo($account_id, $call_id, $hostIndex, $variables, $contentType)
+ ->then(
+ function ($response) {
+ return $response[0];
+ }
+ );
+ }
+
+ /**
+ * Operation getCallStateAsyncWithHttpInfo
+ *
+ * Get Call State Information
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://voice.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $call_id Programmable Voice API Call ID. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getCallState'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function getCallStateAsyncWithHttpInfo(
+ string $account_id,
+ string $call_id,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['getCallState'][0]
+ ): PromiseInterface
+ {
+ $returnType = '\Bandwidth\Model\CallState';
+ $request = $this->getCallStateRequest($account_id, $call_id, $hostIndex, $variables, $contentType);
+
+ return $this->client
+ ->sendAsync($request, $this->createHttpClientOption())
+ ->then(
+ function ($response) use ($returnType) {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ },
+ function ($exception) {
+ $response = $exception->getResponse();
+ $statusCode = $response->getStatusCode();
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ $exception->getRequest()->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+ );
+ }
+
+ /**
+ * Create request for operation 'getCallState'
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://voice.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $call_id Programmable Voice API Call ID. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getCallState'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return \GuzzleHttp\Psr7\Request
+ */
+ public function getCallStateRequest(
+ string $account_id,
+ string $call_id,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['getCallState'][0]
+ ): Request
+ {
+ // verify the required parameter 'account_id' is set
+ if ($account_id === null || (is_array($account_id) && count($account_id) === 0)) {
+ throw new InvalidArgumentException(
+ 'Missing the required parameter $account_id when calling getCallState'
+ );
+ }
+ // verify the required parameter 'call_id' is set
+ if ($call_id === null || (is_array($call_id) && count($call_id) === 0)) {
+ throw new InvalidArgumentException(
+ 'Missing the required parameter $call_id when calling getCallState'
+ );
+ }
+
+ $resourcePath = '/accounts/{accountId}/calls/{callId}';
+ $queryParams = [];
+ $headerParams = [];
+ $httpBody = '';
+ $multipart = false;
+
+
+
+ // path params
+ if ($account_id !== null) {
+ $resourcePath = str_replace(
+ '{accountId}',
+ ObjectSerializer::toPathValue($account_id),
+ $resourcePath
+ );
+ }
+ // path params
+ if ($call_id !== null) {
+ $resourcePath = str_replace(
+ '{callId}',
+ ObjectSerializer::toPathValue($call_id),
+ $resourcePath
+ );
+ }
+
+
+ $headers = $this->headerSelector->selectHeaders(
+ ['application/json', ],
+ $contentType,
+ $multipart
+ );
+
+
+ // this endpoint requires HTTP basic authentication
+ if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) {
+ $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword());
+ }
+
+ // this endpoint requires OAuth (access token)
+ if (!empty($this->config->getAccessToken())) {
+ $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken();
+ }
+
+ $defaultHeaders = [];
+ if ($this->config->getUserAgent()) {
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
+ }
+
+ $headers = array_merge(
+ $defaultHeaders,
+ $headerParams,
+ $headers
+ );
+
+ if ($this->config->getIgnoreOperationHosts()) {
+ $operationHost = $this->config->getHost();
+ } else {
+ # Preserve the original behavior of server indexing.
+ if ($hostIndex === null) {
+ $hostIndex = $this->hostIndex;
+ }
+
+ $hostSettings = $this->getHostSettingsForgetCallState();
+
+ if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) {
+ throw new InvalidArgumentException("Invalid index {$hostIndex} when selecting the host. Must be less than ".count($hostSettings));
+ }
+ $operationHost = Configuration::getHostString($hostSettings, $hostIndex, $variables);
+ }
+ $query = ObjectSerializer::buildQuery($queryParams);
+ return new Request(
+ 'GET',
+ $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
+ $headers,
+ $httpBody
+ );
+ }
+
+ /**
+ * Returns an array of host settings for Operation getCallState
+ *
+ * @return array an array of host settings
+ */
+ protected function getHostSettingsForgetCallState(): array
+ {
+ return [
+ [
+ "url" => "https://voice.bandwidth.com/api/v2",
+ "description" => "Production",
+ ]
+ ];
+ }
+
+ /**
+ * Operation listCalls
+ *
+ * Get Calls
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://voice.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string|null $to Filter results by the `to` field. (optional)
+ * @param string|null $from Filter results by the `from` field. (optional)
+ * @param string|null $min_start_time Filter results to calls which have a `startTime` after or including `minStartTime` (in ISO8601 format). (optional)
+ * @param string|null $max_start_time Filter results to calls which have a `startTime` before or including `maxStartTime` (in ISO8601 format). (optional)
+ * @param string|null $disconnect_cause Filter results to calls with specified call Disconnect Cause. (optional)
+ * @param int|null $page_size Specifies the max number of calls that will be returned. (optional, default to 1000)
+ * @param string|null $page_token Not intended for explicit use. To use pagination, follow the links in the `Link` header of the response, as indicated in the endpoint description. (optional)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listCalls'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return \Bandwidth\Model\CallState[]|\Bandwidth\Model\VoiceApiError
+ */
+ public function listCalls(
+ string $account_id,
+ ?string $to = null,
+ ?string $from = null,
+ ?string $min_start_time = null,
+ ?string $max_start_time = null,
+ ?string $disconnect_cause = null,
+ ?int $page_size = 1000,
+ ?string $page_token = null,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['listCalls'][0]
+ ): array|\Bandwidth\Model\VoiceApiError
+ {
+ list($response) = $this->listCallsWithHttpInfo($account_id, $to, $from, $min_start_time, $max_start_time, $disconnect_cause, $page_size, $page_token, $hostIndex, $variables, $contentType);
+ return $response;
+ }
+
+ /**
+ * Operation listCallsWithHttpInfo
+ *
+ * Get Calls
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://voice.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string|null $to Filter results by the `to` field. (optional)
+ * @param string|null $from Filter results by the `from` field. (optional)
+ * @param string|null $min_start_time Filter results to calls which have a `startTime` after or including `minStartTime` (in ISO8601 format). (optional)
+ * @param string|null $max_start_time Filter results to calls which have a `startTime` before or including `maxStartTime` (in ISO8601 format). (optional)
+ * @param string|null $disconnect_cause Filter results to calls with specified call Disconnect Cause. (optional)
+ * @param int|null $page_size Specifies the max number of calls that will be returned. (optional, default to 1000)
+ * @param string|null $page_token Not intended for explicit use. To use pagination, follow the links in the `Link` header of the response, as indicated in the endpoint description. (optional)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listCalls'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return array{0: \Bandwidth\Model\CallState[]|\Bandwidth\Model\VoiceApiError, 1: int, 2: array} [response data, HTTP status code, HTTP response headers]
+ */
+ public function listCallsWithHttpInfo(
+ string $account_id,
+ ?string $to = null,
+ ?string $from = null,
+ ?string $min_start_time = null,
+ ?string $max_start_time = null,
+ ?string $disconnect_cause = null,
+ ?int $page_size = 1000,
+ ?string $page_token = null,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['listCalls'][0]
+ ): array
+ {
+ $request = $this->listCallsRequest($account_id, $to, $from, $min_start_time, $max_start_time, $disconnect_cause, $page_size, $page_token, $hostIndex, $variables, $contentType);
+
+ try {
+ $options = $this->createHttpClientOption();
+ try {
+ $response = $this->client->send($request, $options);
+ } catch (RequestException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
+ $e->getResponse() ? (string) $e->getResponse()->getBody() : null
+ );
+ } catch (ConnectException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ null,
+ null
+ );
+ }
+
+ $statusCode = $response->getStatusCode();
+
+ switch($statusCode) {
+ case 200:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\CallState[]',
+ $request,
+ $response,
+ );
+ case 400:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\VoiceApiError',
+ $request,
+ $response,
+ );
+ case 401:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\VoiceApiError',
+ $request,
+ $response,
+ );
+ case 403:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\VoiceApiError',
+ $request,
+ $response,
+ );
+ case 404:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\VoiceApiError',
+ $request,
+ $response,
+ );
+ case 405:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\VoiceApiError',
+ $request,
+ $response,
+ );
+ case 415:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\VoiceApiError',
+ $request,
+ $response,
+ );
+ case 429:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\VoiceApiError',
+ $request,
+ $response,
+ );
+ case 500:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\VoiceApiError',
+ $request,
+ $response,
+ );
+ }
+
+ if ($statusCode < 200 || $statusCode > 299) {
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ (string) $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\CallState[]',
+ $request,
+ $response,
+ );
+ } catch (ApiException $e) {
+ switch ($e->getCode()) {
+ case 200:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\CallState[]',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 400:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 401:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 403:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 404:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 405:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 415:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 429:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 500:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ }
+
+ throw $e;
+ }
+ }
+
+ /**
+ * Operation listCallsAsync
+ *
+ * Get Calls
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://voice.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string|null $to Filter results by the `to` field. (optional)
+ * @param string|null $from Filter results by the `from` field. (optional)
+ * @param string|null $min_start_time Filter results to calls which have a `startTime` after or including `minStartTime` (in ISO8601 format). (optional)
+ * @param string|null $max_start_time Filter results to calls which have a `startTime` before or including `maxStartTime` (in ISO8601 format). (optional)
+ * @param string|null $disconnect_cause Filter results to calls with specified call Disconnect Cause. (optional)
+ * @param int|null $page_size Specifies the max number of calls that will be returned. (optional, default to 1000)
+ * @param string|null $page_token Not intended for explicit use. To use pagination, follow the links in the `Link` header of the response, as indicated in the endpoint description. (optional)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listCalls'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function listCallsAsync(
+ string $account_id,
+ ?string $to = null,
+ ?string $from = null,
+ ?string $min_start_time = null,
+ ?string $max_start_time = null,
+ ?string $disconnect_cause = null,
+ ?int $page_size = 1000,
+ ?string $page_token = null,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['listCalls'][0]
+ ): PromiseInterface
+ {
+ return $this->listCallsAsyncWithHttpInfo($account_id, $to, $from, $min_start_time, $max_start_time, $disconnect_cause, $page_size, $page_token, $hostIndex, $variables, $contentType)
+ ->then(
+ function ($response) {
+ return $response[0];
+ }
+ );
+ }
+
+ /**
+ * Operation listCallsAsyncWithHttpInfo
+ *
+ * Get Calls
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://voice.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string|null $to Filter results by the `to` field. (optional)
+ * @param string|null $from Filter results by the `from` field. (optional)
+ * @param string|null $min_start_time Filter results to calls which have a `startTime` after or including `minStartTime` (in ISO8601 format). (optional)
+ * @param string|null $max_start_time Filter results to calls which have a `startTime` before or including `maxStartTime` (in ISO8601 format). (optional)
+ * @param string|null $disconnect_cause Filter results to calls with specified call Disconnect Cause. (optional)
+ * @param int|null $page_size Specifies the max number of calls that will be returned. (optional, default to 1000)
+ * @param string|null $page_token Not intended for explicit use. To use pagination, follow the links in the `Link` header of the response, as indicated in the endpoint description. (optional)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listCalls'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function listCallsAsyncWithHttpInfo(
+ string $account_id,
+ ?string $to = null,
+ ?string $from = null,
+ ?string $min_start_time = null,
+ ?string $max_start_time = null,
+ ?string $disconnect_cause = null,
+ ?int $page_size = 1000,
+ ?string $page_token = null,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['listCalls'][0]
+ ): PromiseInterface
+ {
+ $returnType = '\Bandwidth\Model\CallState[]';
+ $request = $this->listCallsRequest($account_id, $to, $from, $min_start_time, $max_start_time, $disconnect_cause, $page_size, $page_token, $hostIndex, $variables, $contentType);
+
+ return $this->client
+ ->sendAsync($request, $this->createHttpClientOption())
+ ->then(
+ function ($response) use ($returnType) {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ },
+ function ($exception) {
+ $response = $exception->getResponse();
+ $statusCode = $response->getStatusCode();
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ $exception->getRequest()->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+ );
+ }
+
+ /**
+ * Create request for operation 'listCalls'
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://voice.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string|null $to Filter results by the `to` field. (optional)
+ * @param string|null $from Filter results by the `from` field. (optional)
+ * @param string|null $min_start_time Filter results to calls which have a `startTime` after or including `minStartTime` (in ISO8601 format). (optional)
+ * @param string|null $max_start_time Filter results to calls which have a `startTime` before or including `maxStartTime` (in ISO8601 format). (optional)
+ * @param string|null $disconnect_cause Filter results to calls with specified call Disconnect Cause. (optional)
+ * @param int|null $page_size Specifies the max number of calls that will be returned. (optional, default to 1000)
+ * @param string|null $page_token Not intended for explicit use. To use pagination, follow the links in the `Link` header of the response, as indicated in the endpoint description. (optional)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listCalls'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return \GuzzleHttp\Psr7\Request
+ */
+ public function listCallsRequest(
+ string $account_id,
+ ?string $to = null,
+ ?string $from = null,
+ ?string $min_start_time = null,
+ ?string $max_start_time = null,
+ ?string $disconnect_cause = null,
+ ?int $page_size = 1000,
+ ?string $page_token = null,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['listCalls'][0]
+ ): Request
+ {
+ // verify the required parameter 'account_id' is set
+ if ($account_id === null || (is_array($account_id) && count($account_id) === 0)) {
+ throw new InvalidArgumentException(
+ 'Missing the required parameter $account_id when calling listCalls'
+ );
+ }
+ if ($page_size !== null && $page_size > 10000) {
+ throw new InvalidArgumentException('invalid value for "$page_size" when calling CallsApi.listCalls, must be smaller than or equal to 10000.');
+ }
+ if ($page_size !== null && $page_size < 1) {
+ throw new InvalidArgumentException('invalid value for "$page_size" when calling CallsApi.listCalls, must be bigger than or equal to 1.');
+ }
+
+ $resourcePath = '/accounts/{accountId}/calls';
+ $queryParams = [];
+ $headerParams = [];
+ $httpBody = '';
+ $multipart = false;
+
+ // query params
+ $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+ $to,
+ 'to', // param base name
+ 'string', // openApiType
+ 'form', // style
+ true, // explode
+ false // required
+ ) ?? []);
+ // query params
+ $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+ $from,
+ 'from', // param base name
+ 'string', // openApiType
+ 'form', // style
+ true, // explode
+ false // required
+ ) ?? []);
+ // query params
+ $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+ $min_start_time,
+ 'minStartTime', // param base name
+ 'string', // openApiType
+ 'form', // style
+ true, // explode
+ false // required
+ ) ?? []);
+ // query params
+ $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+ $max_start_time,
+ 'maxStartTime', // param base name
+ 'string', // openApiType
+ 'form', // style
+ true, // explode
+ false // required
+ ) ?? []);
+ // query params
+ $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+ $disconnect_cause,
+ 'disconnectCause', // param base name
+ 'string', // openApiType
+ 'form', // style
+ true, // explode
+ false // required
+ ) ?? []);
+ // query params
+ $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+ $page_size,
+ 'pageSize', // param base name
+ 'integer', // openApiType
+ 'form', // style
+ true, // explode
+ false // required
+ ) ?? []);
+ // query params
+ $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+ $page_token,
+ 'pageToken', // param base name
+ 'string', // openApiType
+ 'form', // style
+ true, // explode
+ false // required
+ ) ?? []);
+
+
+ // path params
+ if ($account_id !== null) {
+ $resourcePath = str_replace(
+ '{accountId}',
+ ObjectSerializer::toPathValue($account_id),
+ $resourcePath
+ );
+ }
+
+
+ $headers = $this->headerSelector->selectHeaders(
+ ['application/json', ],
+ $contentType,
+ $multipart
+ );
+
+
+ // this endpoint requires HTTP basic authentication
+ if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) {
+ $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword());
+ }
+
+ // this endpoint requires OAuth (access token)
+ if (!empty($this->config->getAccessToken())) {
+ $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken();
+ }
+
+ $defaultHeaders = [];
+ if ($this->config->getUserAgent()) {
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
+ }
+
+ $headers = array_merge(
+ $defaultHeaders,
+ $headerParams,
+ $headers
+ );
+
+ if ($this->config->getIgnoreOperationHosts()) {
+ $operationHost = $this->config->getHost();
+ } else {
+ # Preserve the original behavior of server indexing.
+ if ($hostIndex === null) {
+ $hostIndex = $this->hostIndex;
+ }
+
+ $hostSettings = $this->getHostSettingsForlistCalls();
+
+ if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) {
+ throw new InvalidArgumentException("Invalid index {$hostIndex} when selecting the host. Must be less than ".count($hostSettings));
+ }
+ $operationHost = Configuration::getHostString($hostSettings, $hostIndex, $variables);
+ }
+ $query = ObjectSerializer::buildQuery($queryParams);
+ return new Request(
+ 'GET',
+ $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
+ $headers,
+ $httpBody
+ );
+ }
+
+ /**
+ * Returns an array of host settings for Operation listCalls
+ *
+ * @return array an array of host settings
+ */
+ protected function getHostSettingsForlistCalls(): array
+ {
+ return [
+ [
+ "url" => "https://voice.bandwidth.com/api/v2",
+ "description" => "Production",
+ ]
+ ];
+ }
+
+ /**
+ * Operation updateCall
+ *
+ * Update Call
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://voice.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $call_id Programmable Voice API Call ID. (required)
+ * @param \Bandwidth\Model\UpdateCall $update_call JSON object containing information to redirect an existing call to a new BXML document (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateCall'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return \Bandwidth\Model\VoiceApiError|null
+ */
+ public function updateCall(
+ string $account_id,
+ string $call_id,
+ \Bandwidth\Model\UpdateCall $update_call,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['updateCall'][0]
+ ): ?\Bandwidth\Model\VoiceApiError
+ {
+ list($response) = $this->updateCallWithHttpInfo($account_id, $call_id, $update_call, $hostIndex, $variables, $contentType);
+ return $response;
+ }
+
+ /**
+ * Operation updateCallWithHttpInfo
+ *
+ * Update Call
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://voice.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $call_id Programmable Voice API Call ID. (required)
+ * @param \Bandwidth\Model\UpdateCall $update_call JSON object containing information to redirect an existing call to a new BXML document (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateCall'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return array{0: null, 1: int, 2: array} [response data, HTTP status code, HTTP response headers]
+ */
+ public function updateCallWithHttpInfo(
+ string $account_id,
+ string $call_id,
+ \Bandwidth\Model\UpdateCall $update_call,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['updateCall'][0]
+ ): array
+ {
+ $request = $this->updateCallRequest($account_id, $call_id, $update_call, $hostIndex, $variables, $contentType);
+
+ try {
+ $options = $this->createHttpClientOption();
+ try {
+ $response = $this->client->send($request, $options);
+ } catch (RequestException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
+ $e->getResponse() ? (string) $e->getResponse()->getBody() : null
+ );
+ } catch (ConnectException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ null,
+ null
+ );
+ }
+
+ $statusCode = $response->getStatusCode();
+
+
+ return [null, $statusCode, $response->getHeaders()];
+ } catch (ApiException $e) {
+ switch ($e->getCode()) {
+ case 400:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 401:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 403:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 404:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 405:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 409:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 415:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 429:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 500:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ }
+
+ throw $e;
+ }
+ }
+
+ /**
+ * Operation updateCallAsync
+ *
+ * Update Call
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://voice.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $call_id Programmable Voice API Call ID. (required)
+ * @param \Bandwidth\Model\UpdateCall $update_call JSON object containing information to redirect an existing call to a new BXML document (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateCall'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function updateCallAsync(
+ string $account_id,
+ string $call_id,
+ \Bandwidth\Model\UpdateCall $update_call,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['updateCall'][0]
+ ): PromiseInterface
+ {
+ return $this->updateCallAsyncWithHttpInfo($account_id, $call_id, $update_call, $hostIndex, $variables, $contentType)
+ ->then(
+ function ($response) {
+ return $response[0];
+ }
+ );
+ }
+
+ /**
+ * Operation updateCallAsyncWithHttpInfo
+ *
+ * Update Call
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://voice.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $call_id Programmable Voice API Call ID. (required)
+ * @param \Bandwidth\Model\UpdateCall $update_call JSON object containing information to redirect an existing call to a new BXML document (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateCall'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function updateCallAsyncWithHttpInfo(
+ string $account_id,
+ string $call_id,
+ \Bandwidth\Model\UpdateCall $update_call,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['updateCall'][0]
+ ): PromiseInterface
+ {
+ $returnType = '';
+ $request = $this->updateCallRequest($account_id, $call_id, $update_call, $hostIndex, $variables, $contentType);
+
+ return $this->client
+ ->sendAsync($request, $this->createHttpClientOption())
+ ->then(
+ function ($response) use ($returnType) {
+ return [null, $response->getStatusCode(), $response->getHeaders()];
+ },
+ function ($exception) {
+ $response = $exception->getResponse();
+ $statusCode = $response->getStatusCode();
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ $exception->getRequest()->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+ );
+ }
+
+ /**
+ * Create request for operation 'updateCall'
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://voice.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $call_id Programmable Voice API Call ID. (required)
+ * @param \Bandwidth\Model\UpdateCall $update_call JSON object containing information to redirect an existing call to a new BXML document (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateCall'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return \GuzzleHttp\Psr7\Request
+ */
+ public function updateCallRequest(
+ string $account_id,
+ string $call_id,
+ \Bandwidth\Model\UpdateCall $update_call,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['updateCall'][0]
+ ): Request
+ {
+ // verify the required parameter 'account_id' is set
+ if ($account_id === null || (is_array($account_id) && count($account_id) === 0)) {
+ throw new InvalidArgumentException(
+ 'Missing the required parameter $account_id when calling updateCall'
+ );
+ }
+ // verify the required parameter 'call_id' is set
+ if ($call_id === null || (is_array($call_id) && count($call_id) === 0)) {
+ throw new InvalidArgumentException(
+ 'Missing the required parameter $call_id when calling updateCall'
+ );
+ }
+ // verify the required parameter 'update_call' is set
+ if ($update_call === null || (is_array($update_call) && count($update_call) === 0)) {
+ throw new InvalidArgumentException(
+ 'Missing the required parameter $update_call when calling updateCall'
+ );
+ }
+
+ $resourcePath = '/accounts/{accountId}/calls/{callId}';
+ $formParams = [];
+ $queryParams = [];
+ $headerParams = [];
+ $httpBody = '';
+ $multipart = false;
+
+
+
+ // path params
+ if ($account_id !== null) {
+ $resourcePath = str_replace(
+ '{accountId}',
+ ObjectSerializer::toPathValue($account_id),
+ $resourcePath
+ );
+ }
+ // path params
+ if ($call_id !== null) {
+ $resourcePath = str_replace(
+ '{callId}',
+ ObjectSerializer::toPathValue($call_id),
+ $resourcePath
+ );
+ }
+
+
+ $headers = $this->headerSelector->selectHeaders(
+ ['application/json', ],
+ $contentType,
+ $multipart
+ );
+
+ // for model (json/xml)
+ if (isset($update_call)) {
+ if (stripos($headers['Content-Type'], 'application/json') !== false) {
+ # if Content-Type contains "application/json", json_encode the body
+ $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($update_call));
+ } else {
+ $httpBody = $update_call;
+ }
+ } elseif (count($formParams) > 0) {
+ if ($multipart) {
+ $multipartContents = [];
+ foreach ($formParams as $formParamName => $formParamValue) {
+ $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
+ foreach ($formParamValueItems as $formParamValueItem) {
+ $multipartContents[] = [
+ 'name' => $formParamName,
+ 'contents' => $formParamValueItem
+ ];
+ }
+ }
+ // for HTTP post (form)
+ $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents);
+
+ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
+ # if Content-Type contains "application/json", json_encode the form parameters
+ $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams);
+ } else {
+ // for HTTP post (form)
+ $httpBody = ObjectSerializer::buildQuery($formParams);
+ }
+ }
+
+ // this endpoint requires HTTP basic authentication
+ if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) {
+ $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword());
+ }
+
+ // this endpoint requires OAuth (access token)
+ if (!empty($this->config->getAccessToken())) {
+ $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken();
+ }
+
+ $defaultHeaders = [];
+ if ($this->config->getUserAgent()) {
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
+ }
+
+ $headers = array_merge(
+ $defaultHeaders,
+ $headerParams,
+ $headers
+ );
+
+ if ($this->config->getIgnoreOperationHosts()) {
+ $operationHost = $this->config->getHost();
+ } else {
+ # Preserve the original behavior of server indexing.
+ if ($hostIndex === null) {
+ $hostIndex = $this->hostIndex;
+ }
+
+ $hostSettings = $this->getHostSettingsForupdateCall();
+
+ if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) {
+ throw new InvalidArgumentException("Invalid index {$hostIndex} when selecting the host. Must be less than ".count($hostSettings));
+ }
+ $operationHost = Configuration::getHostString($hostSettings, $hostIndex, $variables);
+ }
+ $query = ObjectSerializer::buildQuery($queryParams);
+ return new Request(
+ 'POST',
+ $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
+ $headers,
+ $httpBody
+ );
+ }
+
+ /**
+ * Returns an array of host settings for Operation updateCall
+ *
+ * @return array an array of host settings
+ */
+ protected function getHostSettingsForupdateCall(): array
+ {
+ return [
+ [
+ "url" => "https://voice.bandwidth.com/api/v2",
+ "description" => "Production",
+ ]
+ ];
+ }
+
+ /**
+ * Operation updateCallBxml
+ *
+ * Update Call BXML
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://voice.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $call_id Programmable Voice API Call ID. (required)
+ * @param string $body body (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateCallBxml'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return \Bandwidth\Model\VoiceApiError|null
+ */
+ public function updateCallBxml(
+ string $account_id,
+ string $call_id,
+ string $body,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['updateCallBxml'][0]
+ ): ?\Bandwidth\Model\VoiceApiError
+ {
+ list($response) = $this->updateCallBxmlWithHttpInfo($account_id, $call_id, $body, $hostIndex, $variables, $contentType);
+ return $response;
+ }
+
+ /**
+ * Operation updateCallBxmlWithHttpInfo
+ *
+ * Update Call BXML
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://voice.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $call_id Programmable Voice API Call ID. (required)
+ * @param string $body (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateCallBxml'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return array{0: null, 1: int, 2: array} [response data, HTTP status code, HTTP response headers]
+ */
+ public function updateCallBxmlWithHttpInfo(
+ string $account_id,
+ string $call_id,
+ string $body,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['updateCallBxml'][0]
+ ): array
+ {
+ $request = $this->updateCallBxmlRequest($account_id, $call_id, $body, $hostIndex, $variables, $contentType);
+
+ try {
+ $options = $this->createHttpClientOption();
+ try {
+ $response = $this->client->send($request, $options);
+ } catch (RequestException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
+ $e->getResponse() ? (string) $e->getResponse()->getBody() : null
+ );
+ } catch (ConnectException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ null,
+ null
+ );
+ }
+
+ $statusCode = $response->getStatusCode();
+
+
+ return [null, $statusCode, $response->getHeaders()];
+ } catch (ApiException $e) {
+ switch ($e->getCode()) {
+ case 400:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 401:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 403:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 404:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 405:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 409:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 415:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 429:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 500:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ }
+
+ throw $e;
+ }
+ }
+
+ /**
+ * Operation updateCallBxmlAsync
+ *
+ * Update Call BXML
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://voice.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $call_id Programmable Voice API Call ID. (required)
+ * @param string $body (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateCallBxml'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function updateCallBxmlAsync(
+ string $account_id,
+ string $call_id,
+ string $body,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['updateCallBxml'][0]
+ ): PromiseInterface
+ {
+ return $this->updateCallBxmlAsyncWithHttpInfo($account_id, $call_id, $body, $hostIndex, $variables, $contentType)
+ ->then(
+ function ($response) {
+ return $response[0];
+ }
+ );
+ }
+
+ /**
+ * Operation updateCallBxmlAsyncWithHttpInfo
+ *
+ * Update Call BXML
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://voice.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $call_id Programmable Voice API Call ID. (required)
+ * @param string $body (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateCallBxml'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function updateCallBxmlAsyncWithHttpInfo(
+ string $account_id,
+ string $call_id,
+ string $body,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['updateCallBxml'][0]
+ ): PromiseInterface
+ {
+ $returnType = '';
+ $request = $this->updateCallBxmlRequest($account_id, $call_id, $body, $hostIndex, $variables, $contentType);
+
+ return $this->client
+ ->sendAsync($request, $this->createHttpClientOption())
+ ->then(
+ function ($response) use ($returnType) {
+ return [null, $response->getStatusCode(), $response->getHeaders()];
+ },
+ function ($exception) {
+ $response = $exception->getResponse();
+ $statusCode = $response->getStatusCode();
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ $exception->getRequest()->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+ );
+ }
+
+ /**
+ * Create request for operation 'updateCallBxml'
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://voice.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $call_id Programmable Voice API Call ID. (required)
+ * @param string $body (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateCallBxml'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return \GuzzleHttp\Psr7\Request
+ */
+ public function updateCallBxmlRequest(
+ string $account_id,
+ string $call_id,
+ string $body,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['updateCallBxml'][0]
+ ): Request
+ {
+ // verify the required parameter 'account_id' is set
+ if ($account_id === null || (is_array($account_id) && count($account_id) === 0)) {
+ throw new InvalidArgumentException(
+ 'Missing the required parameter $account_id when calling updateCallBxml'
+ );
+ }
+ // verify the required parameter 'call_id' is set
+ if ($call_id === null || (is_array($call_id) && count($call_id) === 0)) {
+ throw new InvalidArgumentException(
+ 'Missing the required parameter $call_id when calling updateCallBxml'
+ );
+ }
+ // verify the required parameter 'body' is set
+ if ($body === null || (is_array($body) && count($body) === 0)) {
+ throw new InvalidArgumentException(
+ 'Missing the required parameter $body when calling updateCallBxml'
+ );
+ }
+
+ $resourcePath = '/accounts/{accountId}/calls/{callId}/bxml';
+ $formParams = [];
+ $queryParams = [];
+ $headerParams = [];
+ $httpBody = '';
+ $multipart = false;
+
+
+
+ // path params
+ if ($account_id !== null) {
+ $resourcePath = str_replace(
+ '{accountId}',
+ ObjectSerializer::toPathValue($account_id),
+ $resourcePath
+ );
+ }
+ // path params
+ if ($call_id !== null) {
+ $resourcePath = str_replace(
+ '{callId}',
+ ObjectSerializer::toPathValue($call_id),
+ $resourcePath
+ );
+ }
+
+
+ $headers = $this->headerSelector->selectHeaders(
+ ['application/json', ],
+ $contentType,
+ $multipart
+ );
+
+ // for model (json/xml)
+ if (isset($body)) {
+ if (stripos($headers['Content-Type'], 'application/json') !== false) {
+ # if Content-Type contains "application/json", json_encode the body
+ $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($body));
+ } else {
+ $httpBody = $body;
+ }
+ } elseif (count($formParams) > 0) {
+ if ($multipart) {
+ $multipartContents = [];
+ foreach ($formParams as $formParamName => $formParamValue) {
+ $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
+ foreach ($formParamValueItems as $formParamValueItem) {
+ $multipartContents[] = [
+ 'name' => $formParamName,
+ 'contents' => $formParamValueItem
+ ];
+ }
+ }
+ // for HTTP post (form)
+ $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents);
+
+ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
+ # if Content-Type contains "application/json", json_encode the form parameters
+ $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams);
+ } else {
+ // for HTTP post (form)
+ $httpBody = ObjectSerializer::buildQuery($formParams);
+ }
+ }
+
+ // this endpoint requires HTTP basic authentication
+ if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) {
+ $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword());
+ }
+
+ // this endpoint requires OAuth (access token)
+ if (!empty($this->config->getAccessToken())) {
+ $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken();
+ }
+
+ $defaultHeaders = [];
+ if ($this->config->getUserAgent()) {
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
+ }
+
+ $headers = array_merge(
+ $defaultHeaders,
+ $headerParams,
+ $headers
+ );
+
+ if ($this->config->getIgnoreOperationHosts()) {
+ $operationHost = $this->config->getHost();
+ } else {
+ # Preserve the original behavior of server indexing.
+ if ($hostIndex === null) {
+ $hostIndex = $this->hostIndex;
+ }
+
+ $hostSettings = $this->getHostSettingsForupdateCallBxml();
+
+ if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) {
+ throw new InvalidArgumentException("Invalid index {$hostIndex} when selecting the host. Must be less than ".count($hostSettings));
+ }
+ $operationHost = Configuration::getHostString($hostSettings, $hostIndex, $variables);
+ }
+ $query = ObjectSerializer::buildQuery($queryParams);
+ return new Request(
+ 'PUT',
+ $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
+ $headers,
+ $httpBody
+ );
+ }
+
+ /**
+ * Returns an array of host settings for Operation updateCallBxml
+ *
+ * @return array an array of host settings
+ */
+ protected function getHostSettingsForupdateCallBxml(): array
+ {
+ return [
+ [
+ "url" => "https://voice.bandwidth.com/api/v2",
+ "description" => "Production",
+ ]
+ ];
+ }
+
+ /**
+ * Create http client option
+ *
+ * @throws \RuntimeException on file opening failure
+ * @return array of http client options
+ */
+ protected function createHttpClientOption(): array
+ {
+ $options = [];
+ if ($this->config->getDebug()) {
+ $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a');
+ if (!$options[RequestOptions::DEBUG]) {
+ throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile());
+ }
+ }
+
+ return $options;
+ }
+
+ private function handleResponseWithDataType(
+ string $dataType,
+ RequestInterface $request,
+ ResponseInterface $response,
+ ): array {
+ if (in_array($dataType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($dataType !== 'string') {
+ try {
+ $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR);
+ } catch (\JsonException $exception) {
+ throw new ApiException(
+ sprintf(
+ 'Error JSON decoding server response (%s)',
+ $request->getUri()
+ ),
+ $response->getStatusCode(),
+ $response->getHeaders(),
+ $content
+ );
+ }
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $dataType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ }
+
+ private function responseWithinRangeCode(
+ string $rangeCode,
+ int $statusCode,
+ ): bool {
+ $left = (int) ($rangeCode[0].'00');
+ $right = (int) ($rangeCode[0].'99');
+
+ return $statusCode >= $left && $statusCode <= $right;
+ }
+}
diff --git a/src/Api/ConferencesApi.php b/src/Api/ConferencesApi.php
new file mode 100644
index 0000000..b90c9fe
--- /dev/null
+++ b/src/Api/ConferencesApi.php
@@ -0,0 +1,4441 @@
+ $contentTypes **/
+ public const contentTypes = [
+ 'downloadConferenceRecording' => [
+ 'application/json',
+ ],
+ 'getConference' => [
+ 'application/json',
+ ],
+ 'getConferenceMember' => [
+ 'application/json',
+ ],
+ 'getConferenceRecording' => [
+ 'application/json',
+ ],
+ 'listConferenceRecordings' => [
+ 'application/json',
+ ],
+ 'listConferences' => [
+ 'application/json',
+ ],
+ 'updateConference' => [
+ 'application/json',
+ ],
+ 'updateConferenceBxml' => [
+ 'application/xml',
+ ],
+ 'updateConferenceMember' => [
+ 'application/json',
+ ],
+ ];
+
+ /**
+ * @param ClientInterface|null $client
+ * @param Configuration|null $config
+ * @param HeaderSelector|null $selector
+ * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec
+ */
+ public function __construct(
+ ?ClientInterface $client = null,
+ ?Configuration $config = null,
+ ?HeaderSelector $selector = null,
+ int $hostIndex = 0
+ ) {
+ $this->client = $client ?: new Client();
+ $this->config = $config ?: Configuration::getDefaultConfiguration();
+ $this->headerSelector = $selector ?: new HeaderSelector();
+ $this->hostIndex = $hostIndex;
+ }
+
+ /**
+ * Set the host index
+ *
+ * @param int $hostIndex Host index (required)
+ */
+ public function setHostIndex(int $hostIndex): void
+ {
+ $this->hostIndex = $hostIndex;
+ }
+
+ /**
+ * Get the host index
+ *
+ * @return int Host index
+ */
+ public function getHostIndex(): int
+ {
+ return $this->hostIndex;
+ }
+
+ /**
+ * @return Configuration
+ */
+ public function getConfig(): Configuration
+ {
+ return $this->config;
+ }
+
+ /**
+ * Operation downloadConferenceRecording
+ *
+ * Download Conference Recording
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://voice.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $conference_id Programmable Voice API Conference ID. (required)
+ * @param string $recording_id Programmable Voice API Recording ID. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['downloadConferenceRecording'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return \SplFileObject|\Bandwidth\Model\VoiceApiError
+ */
+ public function downloadConferenceRecording(
+ string $account_id,
+ string $conference_id,
+ string $recording_id,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['downloadConferenceRecording'][0]
+ ): \SplFileObject|\Bandwidth\Model\VoiceApiError
+ {
+ list($response) = $this->downloadConferenceRecordingWithHttpInfo($account_id, $conference_id, $recording_id, $hostIndex, $variables, $contentType);
+ return $response;
+ }
+
+ /**
+ * Operation downloadConferenceRecordingWithHttpInfo
+ *
+ * Download Conference Recording
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://voice.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $conference_id Programmable Voice API Conference ID. (required)
+ * @param string $recording_id Programmable Voice API Recording ID. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['downloadConferenceRecording'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return array{0: \SplFileObject|\Bandwidth\Model\VoiceApiError, 1: int, 2: array} [response data, HTTP status code, HTTP response headers]
+ */
+ public function downloadConferenceRecordingWithHttpInfo(
+ string $account_id,
+ string $conference_id,
+ string $recording_id,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['downloadConferenceRecording'][0]
+ ): array
+ {
+ $request = $this->downloadConferenceRecordingRequest($account_id, $conference_id, $recording_id, $hostIndex, $variables, $contentType);
+
+ try {
+ $options = $this->createHttpClientOption();
+ try {
+ $response = $this->client->send($request, $options);
+ } catch (RequestException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
+ $e->getResponse() ? (string) $e->getResponse()->getBody() : null
+ );
+ } catch (ConnectException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ null,
+ null
+ );
+ }
+
+ $statusCode = $response->getStatusCode();
+
+ switch($statusCode) {
+ case 200:
+ return $this->handleResponseWithDataType(
+ '\SplFileObject',
+ $request,
+ $response,
+ );
+ case 400:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\VoiceApiError',
+ $request,
+ $response,
+ );
+ case 401:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\VoiceApiError',
+ $request,
+ $response,
+ );
+ case 403:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\VoiceApiError',
+ $request,
+ $response,
+ );
+ case 404:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\VoiceApiError',
+ $request,
+ $response,
+ );
+ case 405:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\VoiceApiError',
+ $request,
+ $response,
+ );
+ case 415:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\VoiceApiError',
+ $request,
+ $response,
+ );
+ case 429:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\VoiceApiError',
+ $request,
+ $response,
+ );
+ case 500:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\VoiceApiError',
+ $request,
+ $response,
+ );
+ }
+
+ if ($statusCode < 200 || $statusCode > 299) {
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ (string) $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+
+ return $this->handleResponseWithDataType(
+ '\SplFileObject',
+ $request,
+ $response,
+ );
+ } catch (ApiException $e) {
+ switch ($e->getCode()) {
+ case 200:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\SplFileObject',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 400:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 401:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 403:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 404:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 405:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 415:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 429:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 500:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ }
+
+ throw $e;
+ }
+ }
+
+ /**
+ * Operation downloadConferenceRecordingAsync
+ *
+ * Download Conference Recording
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://voice.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $conference_id Programmable Voice API Conference ID. (required)
+ * @param string $recording_id Programmable Voice API Recording ID. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['downloadConferenceRecording'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function downloadConferenceRecordingAsync(
+ string $account_id,
+ string $conference_id,
+ string $recording_id,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['downloadConferenceRecording'][0]
+ ): PromiseInterface
+ {
+ return $this->downloadConferenceRecordingAsyncWithHttpInfo($account_id, $conference_id, $recording_id, $hostIndex, $variables, $contentType)
+ ->then(
+ function ($response) {
+ return $response[0];
+ }
+ );
+ }
+
+ /**
+ * Operation downloadConferenceRecordingAsyncWithHttpInfo
+ *
+ * Download Conference Recording
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://voice.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $conference_id Programmable Voice API Conference ID. (required)
+ * @param string $recording_id Programmable Voice API Recording ID. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['downloadConferenceRecording'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function downloadConferenceRecordingAsyncWithHttpInfo(
+ string $account_id,
+ string $conference_id,
+ string $recording_id,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['downloadConferenceRecording'][0]
+ ): PromiseInterface
+ {
+ $returnType = '\SplFileObject';
+ $request = $this->downloadConferenceRecordingRequest($account_id, $conference_id, $recording_id, $hostIndex, $variables, $contentType);
+
+ return $this->client
+ ->sendAsync($request, $this->createHttpClientOption())
+ ->then(
+ function ($response) use ($returnType) {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ },
+ function ($exception) {
+ $response = $exception->getResponse();
+ $statusCode = $response->getStatusCode();
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ $exception->getRequest()->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+ );
+ }
+
+ /**
+ * Create request for operation 'downloadConferenceRecording'
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://voice.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $conference_id Programmable Voice API Conference ID. (required)
+ * @param string $recording_id Programmable Voice API Recording ID. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['downloadConferenceRecording'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return \GuzzleHttp\Psr7\Request
+ */
+ public function downloadConferenceRecordingRequest(
+ string $account_id,
+ string $conference_id,
+ string $recording_id,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['downloadConferenceRecording'][0]
+ ): Request
+ {
+ // verify the required parameter 'account_id' is set
+ if ($account_id === null || (is_array($account_id) && count($account_id) === 0)) {
+ throw new InvalidArgumentException(
+ 'Missing the required parameter $account_id when calling downloadConferenceRecording'
+ );
+ }
+ // verify the required parameter 'conference_id' is set
+ if ($conference_id === null || (is_array($conference_id) && count($conference_id) === 0)) {
+ throw new InvalidArgumentException(
+ 'Missing the required parameter $conference_id when calling downloadConferenceRecording'
+ );
+ }
+ // verify the required parameter 'recording_id' is set
+ if ($recording_id === null || (is_array($recording_id) && count($recording_id) === 0)) {
+ throw new InvalidArgumentException(
+ 'Missing the required parameter $recording_id when calling downloadConferenceRecording'
+ );
+ }
+
+ $resourcePath = '/accounts/{accountId}/conferences/{conferenceId}/recordings/{recordingId}/media';
+ $queryParams = [];
+ $headerParams = [];
+ $httpBody = '';
+ $multipart = false;
+
+
+
+ // path params
+ if ($account_id !== null) {
+ $resourcePath = str_replace(
+ '{accountId}',
+ ObjectSerializer::toPathValue($account_id),
+ $resourcePath
+ );
+ }
+ // path params
+ if ($conference_id !== null) {
+ $resourcePath = str_replace(
+ '{conferenceId}',
+ ObjectSerializer::toPathValue($conference_id),
+ $resourcePath
+ );
+ }
+ // path params
+ if ($recording_id !== null) {
+ $resourcePath = str_replace(
+ '{recordingId}',
+ ObjectSerializer::toPathValue($recording_id),
+ $resourcePath
+ );
+ }
+
+
+ $headers = $this->headerSelector->selectHeaders(
+ ['audio/vnd.wave', 'audio/mpeg', 'application/json', ],
+ $contentType,
+ $multipart
+ );
+
+
+ // this endpoint requires HTTP basic authentication
+ if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) {
+ $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword());
+ }
+
+ // this endpoint requires OAuth (access token)
+ if (!empty($this->config->getAccessToken())) {
+ $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken();
+ }
+
+ $defaultHeaders = [];
+ if ($this->config->getUserAgent()) {
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
+ }
+
+ $headers = array_merge(
+ $defaultHeaders,
+ $headerParams,
+ $headers
+ );
+
+ if ($this->config->getIgnoreOperationHosts()) {
+ $operationHost = $this->config->getHost();
+ } else {
+ # Preserve the original behavior of server indexing.
+ if ($hostIndex === null) {
+ $hostIndex = $this->hostIndex;
+ }
+
+ $hostSettings = $this->getHostSettingsFordownloadConferenceRecording();
+
+ if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) {
+ throw new InvalidArgumentException("Invalid index {$hostIndex} when selecting the host. Must be less than ".count($hostSettings));
+ }
+ $operationHost = Configuration::getHostString($hostSettings, $hostIndex, $variables);
+ }
+ $query = ObjectSerializer::buildQuery($queryParams);
+ return new Request(
+ 'GET',
+ $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
+ $headers,
+ $httpBody
+ );
+ }
+
+ /**
+ * Returns an array of host settings for Operation downloadConferenceRecording
+ *
+ * @return array an array of host settings
+ */
+ protected function getHostSettingsFordownloadConferenceRecording(): array
+ {
+ return [
+ [
+ "url" => "https://voice.bandwidth.com/api/v2",
+ "description" => "Production",
+ ]
+ ];
+ }
+
+ /**
+ * Operation getConference
+ *
+ * Get Conference Information
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://voice.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $conference_id Programmable Voice API Conference ID. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getConference'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return \Bandwidth\Model\Conference|\Bandwidth\Model\VoiceApiError
+ */
+ public function getConference(
+ string $account_id,
+ string $conference_id,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['getConference'][0]
+ ): \Bandwidth\Model\Conference|\Bandwidth\Model\VoiceApiError
+ {
+ list($response) = $this->getConferenceWithHttpInfo($account_id, $conference_id, $hostIndex, $variables, $contentType);
+ return $response;
+ }
+
+ /**
+ * Operation getConferenceWithHttpInfo
+ *
+ * Get Conference Information
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://voice.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $conference_id Programmable Voice API Conference ID. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getConference'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return array{0: \Bandwidth\Model\Conference|\Bandwidth\Model\VoiceApiError, 1: int, 2: array} [response data, HTTP status code, HTTP response headers]
+ */
+ public function getConferenceWithHttpInfo(
+ string $account_id,
+ string $conference_id,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['getConference'][0]
+ ): array
+ {
+ $request = $this->getConferenceRequest($account_id, $conference_id, $hostIndex, $variables, $contentType);
+
+ try {
+ $options = $this->createHttpClientOption();
+ try {
+ $response = $this->client->send($request, $options);
+ } catch (RequestException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
+ $e->getResponse() ? (string) $e->getResponse()->getBody() : null
+ );
+ } catch (ConnectException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ null,
+ null
+ );
+ }
+
+ $statusCode = $response->getStatusCode();
+
+ switch($statusCode) {
+ case 200:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\Conference',
+ $request,
+ $response,
+ );
+ case 400:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\VoiceApiError',
+ $request,
+ $response,
+ );
+ case 401:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\VoiceApiError',
+ $request,
+ $response,
+ );
+ case 403:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\VoiceApiError',
+ $request,
+ $response,
+ );
+ case 404:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\VoiceApiError',
+ $request,
+ $response,
+ );
+ case 405:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\VoiceApiError',
+ $request,
+ $response,
+ );
+ case 415:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\VoiceApiError',
+ $request,
+ $response,
+ );
+ case 429:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\VoiceApiError',
+ $request,
+ $response,
+ );
+ case 500:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\VoiceApiError',
+ $request,
+ $response,
+ );
+ }
+
+ if ($statusCode < 200 || $statusCode > 299) {
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ (string) $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\Conference',
+ $request,
+ $response,
+ );
+ } catch (ApiException $e) {
+ switch ($e->getCode()) {
+ case 200:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\Conference',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 400:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 401:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 403:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 404:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 405:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 415:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 429:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 500:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ }
+
+ throw $e;
+ }
+ }
+
+ /**
+ * Operation getConferenceAsync
+ *
+ * Get Conference Information
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://voice.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $conference_id Programmable Voice API Conference ID. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getConference'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function getConferenceAsync(
+ string $account_id,
+ string $conference_id,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['getConference'][0]
+ ): PromiseInterface
+ {
+ return $this->getConferenceAsyncWithHttpInfo($account_id, $conference_id, $hostIndex, $variables, $contentType)
+ ->then(
+ function ($response) {
+ return $response[0];
+ }
+ );
+ }
+
+ /**
+ * Operation getConferenceAsyncWithHttpInfo
+ *
+ * Get Conference Information
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://voice.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $conference_id Programmable Voice API Conference ID. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getConference'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function getConferenceAsyncWithHttpInfo(
+ string $account_id,
+ string $conference_id,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['getConference'][0]
+ ): PromiseInterface
+ {
+ $returnType = '\Bandwidth\Model\Conference';
+ $request = $this->getConferenceRequest($account_id, $conference_id, $hostIndex, $variables, $contentType);
+
+ return $this->client
+ ->sendAsync($request, $this->createHttpClientOption())
+ ->then(
+ function ($response) use ($returnType) {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ },
+ function ($exception) {
+ $response = $exception->getResponse();
+ $statusCode = $response->getStatusCode();
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ $exception->getRequest()->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+ );
+ }
+
+ /**
+ * Create request for operation 'getConference'
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://voice.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $conference_id Programmable Voice API Conference ID. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getConference'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return \GuzzleHttp\Psr7\Request
+ */
+ public function getConferenceRequest(
+ string $account_id,
+ string $conference_id,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['getConference'][0]
+ ): Request
+ {
+ // verify the required parameter 'account_id' is set
+ if ($account_id === null || (is_array($account_id) && count($account_id) === 0)) {
+ throw new InvalidArgumentException(
+ 'Missing the required parameter $account_id when calling getConference'
+ );
+ }
+ // verify the required parameter 'conference_id' is set
+ if ($conference_id === null || (is_array($conference_id) && count($conference_id) === 0)) {
+ throw new InvalidArgumentException(
+ 'Missing the required parameter $conference_id when calling getConference'
+ );
+ }
+
+ $resourcePath = '/accounts/{accountId}/conferences/{conferenceId}';
+ $queryParams = [];
+ $headerParams = [];
+ $httpBody = '';
+ $multipart = false;
+
+
+
+ // path params
+ if ($account_id !== null) {
+ $resourcePath = str_replace(
+ '{accountId}',
+ ObjectSerializer::toPathValue($account_id),
+ $resourcePath
+ );
+ }
+ // path params
+ if ($conference_id !== null) {
+ $resourcePath = str_replace(
+ '{conferenceId}',
+ ObjectSerializer::toPathValue($conference_id),
+ $resourcePath
+ );
+ }
+
+
+ $headers = $this->headerSelector->selectHeaders(
+ ['application/json', ],
+ $contentType,
+ $multipart
+ );
+
+
+ // this endpoint requires HTTP basic authentication
+ if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) {
+ $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword());
+ }
+
+ // this endpoint requires OAuth (access token)
+ if (!empty($this->config->getAccessToken())) {
+ $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken();
+ }
+
+ $defaultHeaders = [];
+ if ($this->config->getUserAgent()) {
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
+ }
+
+ $headers = array_merge(
+ $defaultHeaders,
+ $headerParams,
+ $headers
+ );
+
+ if ($this->config->getIgnoreOperationHosts()) {
+ $operationHost = $this->config->getHost();
+ } else {
+ # Preserve the original behavior of server indexing.
+ if ($hostIndex === null) {
+ $hostIndex = $this->hostIndex;
+ }
+
+ $hostSettings = $this->getHostSettingsForgetConference();
+
+ if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) {
+ throw new InvalidArgumentException("Invalid index {$hostIndex} when selecting the host. Must be less than ".count($hostSettings));
+ }
+ $operationHost = Configuration::getHostString($hostSettings, $hostIndex, $variables);
+ }
+ $query = ObjectSerializer::buildQuery($queryParams);
+ return new Request(
+ 'GET',
+ $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
+ $headers,
+ $httpBody
+ );
+ }
+
+ /**
+ * Returns an array of host settings for Operation getConference
+ *
+ * @return array an array of host settings
+ */
+ protected function getHostSettingsForgetConference(): array
+ {
+ return [
+ [
+ "url" => "https://voice.bandwidth.com/api/v2",
+ "description" => "Production",
+ ]
+ ];
+ }
+
+ /**
+ * Operation getConferenceMember
+ *
+ * Get Conference Member
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://voice.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $conference_id Programmable Voice API Conference ID. (required)
+ * @param string $member_id Programmable Voice API Conference Member ID. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getConferenceMember'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return \Bandwidth\Model\ConferenceMember|\Bandwidth\Model\VoiceApiError
+ */
+ public function getConferenceMember(
+ string $account_id,
+ string $conference_id,
+ string $member_id,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['getConferenceMember'][0]
+ ): \Bandwidth\Model\ConferenceMember|\Bandwidth\Model\VoiceApiError
+ {
+ list($response) = $this->getConferenceMemberWithHttpInfo($account_id, $conference_id, $member_id, $hostIndex, $variables, $contentType);
+ return $response;
+ }
+
+ /**
+ * Operation getConferenceMemberWithHttpInfo
+ *
+ * Get Conference Member
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://voice.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $conference_id Programmable Voice API Conference ID. (required)
+ * @param string $member_id Programmable Voice API Conference Member ID. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getConferenceMember'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return array{0: \Bandwidth\Model\ConferenceMember|\Bandwidth\Model\VoiceApiError, 1: int, 2: array} [response data, HTTP status code, HTTP response headers]
+ */
+ public function getConferenceMemberWithHttpInfo(
+ string $account_id,
+ string $conference_id,
+ string $member_id,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['getConferenceMember'][0]
+ ): array
+ {
+ $request = $this->getConferenceMemberRequest($account_id, $conference_id, $member_id, $hostIndex, $variables, $contentType);
+
+ try {
+ $options = $this->createHttpClientOption();
+ try {
+ $response = $this->client->send($request, $options);
+ } catch (RequestException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
+ $e->getResponse() ? (string) $e->getResponse()->getBody() : null
+ );
+ } catch (ConnectException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ null,
+ null
+ );
+ }
+
+ $statusCode = $response->getStatusCode();
+
+ switch($statusCode) {
+ case 200:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\ConferenceMember',
+ $request,
+ $response,
+ );
+ case 400:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\VoiceApiError',
+ $request,
+ $response,
+ );
+ case 401:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\VoiceApiError',
+ $request,
+ $response,
+ );
+ case 403:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\VoiceApiError',
+ $request,
+ $response,
+ );
+ case 404:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\VoiceApiError',
+ $request,
+ $response,
+ );
+ case 405:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\VoiceApiError',
+ $request,
+ $response,
+ );
+ case 415:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\VoiceApiError',
+ $request,
+ $response,
+ );
+ case 429:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\VoiceApiError',
+ $request,
+ $response,
+ );
+ case 500:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\VoiceApiError',
+ $request,
+ $response,
+ );
+ }
+
+ if ($statusCode < 200 || $statusCode > 299) {
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ (string) $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\ConferenceMember',
+ $request,
+ $response,
+ );
+ } catch (ApiException $e) {
+ switch ($e->getCode()) {
+ case 200:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\ConferenceMember',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 400:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 401:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 403:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 404:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 405:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 415:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 429:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 500:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ }
+
+ throw $e;
+ }
+ }
+
+ /**
+ * Operation getConferenceMemberAsync
+ *
+ * Get Conference Member
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://voice.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $conference_id Programmable Voice API Conference ID. (required)
+ * @param string $member_id Programmable Voice API Conference Member ID. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getConferenceMember'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function getConferenceMemberAsync(
+ string $account_id,
+ string $conference_id,
+ string $member_id,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['getConferenceMember'][0]
+ ): PromiseInterface
+ {
+ return $this->getConferenceMemberAsyncWithHttpInfo($account_id, $conference_id, $member_id, $hostIndex, $variables, $contentType)
+ ->then(
+ function ($response) {
+ return $response[0];
+ }
+ );
+ }
+
+ /**
+ * Operation getConferenceMemberAsyncWithHttpInfo
+ *
+ * Get Conference Member
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://voice.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $conference_id Programmable Voice API Conference ID. (required)
+ * @param string $member_id Programmable Voice API Conference Member ID. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getConferenceMember'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function getConferenceMemberAsyncWithHttpInfo(
+ string $account_id,
+ string $conference_id,
+ string $member_id,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['getConferenceMember'][0]
+ ): PromiseInterface
+ {
+ $returnType = '\Bandwidth\Model\ConferenceMember';
+ $request = $this->getConferenceMemberRequest($account_id, $conference_id, $member_id, $hostIndex, $variables, $contentType);
+
+ return $this->client
+ ->sendAsync($request, $this->createHttpClientOption())
+ ->then(
+ function ($response) use ($returnType) {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ },
+ function ($exception) {
+ $response = $exception->getResponse();
+ $statusCode = $response->getStatusCode();
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ $exception->getRequest()->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+ );
+ }
+
+ /**
+ * Create request for operation 'getConferenceMember'
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://voice.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $conference_id Programmable Voice API Conference ID. (required)
+ * @param string $member_id Programmable Voice API Conference Member ID. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getConferenceMember'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return \GuzzleHttp\Psr7\Request
+ */
+ public function getConferenceMemberRequest(
+ string $account_id,
+ string $conference_id,
+ string $member_id,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['getConferenceMember'][0]
+ ): Request
+ {
+ // verify the required parameter 'account_id' is set
+ if ($account_id === null || (is_array($account_id) && count($account_id) === 0)) {
+ throw new InvalidArgumentException(
+ 'Missing the required parameter $account_id when calling getConferenceMember'
+ );
+ }
+ // verify the required parameter 'conference_id' is set
+ if ($conference_id === null || (is_array($conference_id) && count($conference_id) === 0)) {
+ throw new InvalidArgumentException(
+ 'Missing the required parameter $conference_id when calling getConferenceMember'
+ );
+ }
+ // verify the required parameter 'member_id' is set
+ if ($member_id === null || (is_array($member_id) && count($member_id) === 0)) {
+ throw new InvalidArgumentException(
+ 'Missing the required parameter $member_id when calling getConferenceMember'
+ );
+ }
+
+ $resourcePath = '/accounts/{accountId}/conferences/{conferenceId}/members/{memberId}';
+ $queryParams = [];
+ $headerParams = [];
+ $httpBody = '';
+ $multipart = false;
+
+
+
+ // path params
+ if ($account_id !== null) {
+ $resourcePath = str_replace(
+ '{accountId}',
+ ObjectSerializer::toPathValue($account_id),
+ $resourcePath
+ );
+ }
+ // path params
+ if ($conference_id !== null) {
+ $resourcePath = str_replace(
+ '{conferenceId}',
+ ObjectSerializer::toPathValue($conference_id),
+ $resourcePath
+ );
+ }
+ // path params
+ if ($member_id !== null) {
+ $resourcePath = str_replace(
+ '{memberId}',
+ ObjectSerializer::toPathValue($member_id),
+ $resourcePath
+ );
+ }
+
+
+ $headers = $this->headerSelector->selectHeaders(
+ ['application/json', ],
+ $contentType,
+ $multipart
+ );
+
+
+ // this endpoint requires HTTP basic authentication
+ if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) {
+ $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword());
+ }
+
+ // this endpoint requires OAuth (access token)
+ if (!empty($this->config->getAccessToken())) {
+ $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken();
+ }
+
+ $defaultHeaders = [];
+ if ($this->config->getUserAgent()) {
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
+ }
+
+ $headers = array_merge(
+ $defaultHeaders,
+ $headerParams,
+ $headers
+ );
+
+ if ($this->config->getIgnoreOperationHosts()) {
+ $operationHost = $this->config->getHost();
+ } else {
+ # Preserve the original behavior of server indexing.
+ if ($hostIndex === null) {
+ $hostIndex = $this->hostIndex;
+ }
+
+ $hostSettings = $this->getHostSettingsForgetConferenceMember();
+
+ if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) {
+ throw new InvalidArgumentException("Invalid index {$hostIndex} when selecting the host. Must be less than ".count($hostSettings));
+ }
+ $operationHost = Configuration::getHostString($hostSettings, $hostIndex, $variables);
+ }
+ $query = ObjectSerializer::buildQuery($queryParams);
+ return new Request(
+ 'GET',
+ $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
+ $headers,
+ $httpBody
+ );
+ }
+
+ /**
+ * Returns an array of host settings for Operation getConferenceMember
+ *
+ * @return array an array of host settings
+ */
+ protected function getHostSettingsForgetConferenceMember(): array
+ {
+ return [
+ [
+ "url" => "https://voice.bandwidth.com/api/v2",
+ "description" => "Production",
+ ]
+ ];
+ }
+
+ /**
+ * Operation getConferenceRecording
+ *
+ * Get Conference Recording Information
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://voice.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $conference_id Programmable Voice API Conference ID. (required)
+ * @param string $recording_id Programmable Voice API Recording ID. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getConferenceRecording'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return \Bandwidth\Model\ConferenceRecordingMetadata|\Bandwidth\Model\VoiceApiError
+ */
+ public function getConferenceRecording(
+ string $account_id,
+ string $conference_id,
+ string $recording_id,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['getConferenceRecording'][0]
+ ): \Bandwidth\Model\ConferenceRecordingMetadata|\Bandwidth\Model\VoiceApiError
+ {
+ list($response) = $this->getConferenceRecordingWithHttpInfo($account_id, $conference_id, $recording_id, $hostIndex, $variables, $contentType);
+ return $response;
+ }
+
+ /**
+ * Operation getConferenceRecordingWithHttpInfo
+ *
+ * Get Conference Recording Information
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://voice.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $conference_id Programmable Voice API Conference ID. (required)
+ * @param string $recording_id Programmable Voice API Recording ID. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getConferenceRecording'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return array{0: \Bandwidth\Model\ConferenceRecordingMetadata|\Bandwidth\Model\VoiceApiError, 1: int, 2: array} [response data, HTTP status code, HTTP response headers]
+ */
+ public function getConferenceRecordingWithHttpInfo(
+ string $account_id,
+ string $conference_id,
+ string $recording_id,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['getConferenceRecording'][0]
+ ): array
+ {
+ $request = $this->getConferenceRecordingRequest($account_id, $conference_id, $recording_id, $hostIndex, $variables, $contentType);
+
+ try {
+ $options = $this->createHttpClientOption();
+ try {
+ $response = $this->client->send($request, $options);
+ } catch (RequestException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
+ $e->getResponse() ? (string) $e->getResponse()->getBody() : null
+ );
+ } catch (ConnectException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ null,
+ null
+ );
+ }
+
+ $statusCode = $response->getStatusCode();
+
+ switch($statusCode) {
+ case 200:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\ConferenceRecordingMetadata',
+ $request,
+ $response,
+ );
+ case 400:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\VoiceApiError',
+ $request,
+ $response,
+ );
+ case 401:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\VoiceApiError',
+ $request,
+ $response,
+ );
+ case 403:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\VoiceApiError',
+ $request,
+ $response,
+ );
+ case 404:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\VoiceApiError',
+ $request,
+ $response,
+ );
+ case 405:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\VoiceApiError',
+ $request,
+ $response,
+ );
+ case 415:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\VoiceApiError',
+ $request,
+ $response,
+ );
+ case 429:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\VoiceApiError',
+ $request,
+ $response,
+ );
+ case 500:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\VoiceApiError',
+ $request,
+ $response,
+ );
+ }
+
+ if ($statusCode < 200 || $statusCode > 299) {
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ (string) $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\ConferenceRecordingMetadata',
+ $request,
+ $response,
+ );
+ } catch (ApiException $e) {
+ switch ($e->getCode()) {
+ case 200:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\ConferenceRecordingMetadata',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 400:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 401:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 403:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 404:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 405:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 415:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 429:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 500:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ }
+
+ throw $e;
+ }
+ }
+
+ /**
+ * Operation getConferenceRecordingAsync
+ *
+ * Get Conference Recording Information
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://voice.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $conference_id Programmable Voice API Conference ID. (required)
+ * @param string $recording_id Programmable Voice API Recording ID. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getConferenceRecording'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function getConferenceRecordingAsync(
+ string $account_id,
+ string $conference_id,
+ string $recording_id,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['getConferenceRecording'][0]
+ ): PromiseInterface
+ {
+ return $this->getConferenceRecordingAsyncWithHttpInfo($account_id, $conference_id, $recording_id, $hostIndex, $variables, $contentType)
+ ->then(
+ function ($response) {
+ return $response[0];
+ }
+ );
+ }
+
+ /**
+ * Operation getConferenceRecordingAsyncWithHttpInfo
+ *
+ * Get Conference Recording Information
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://voice.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $conference_id Programmable Voice API Conference ID. (required)
+ * @param string $recording_id Programmable Voice API Recording ID. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getConferenceRecording'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function getConferenceRecordingAsyncWithHttpInfo(
+ string $account_id,
+ string $conference_id,
+ string $recording_id,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['getConferenceRecording'][0]
+ ): PromiseInterface
+ {
+ $returnType = '\Bandwidth\Model\ConferenceRecordingMetadata';
+ $request = $this->getConferenceRecordingRequest($account_id, $conference_id, $recording_id, $hostIndex, $variables, $contentType);
+
+ return $this->client
+ ->sendAsync($request, $this->createHttpClientOption())
+ ->then(
+ function ($response) use ($returnType) {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ },
+ function ($exception) {
+ $response = $exception->getResponse();
+ $statusCode = $response->getStatusCode();
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ $exception->getRequest()->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+ );
+ }
+
+ /**
+ * Create request for operation 'getConferenceRecording'
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://voice.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $conference_id Programmable Voice API Conference ID. (required)
+ * @param string $recording_id Programmable Voice API Recording ID. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getConferenceRecording'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return \GuzzleHttp\Psr7\Request
+ */
+ public function getConferenceRecordingRequest(
+ string $account_id,
+ string $conference_id,
+ string $recording_id,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['getConferenceRecording'][0]
+ ): Request
+ {
+ // verify the required parameter 'account_id' is set
+ if ($account_id === null || (is_array($account_id) && count($account_id) === 0)) {
+ throw new InvalidArgumentException(
+ 'Missing the required parameter $account_id when calling getConferenceRecording'
+ );
+ }
+ // verify the required parameter 'conference_id' is set
+ if ($conference_id === null || (is_array($conference_id) && count($conference_id) === 0)) {
+ throw new InvalidArgumentException(
+ 'Missing the required parameter $conference_id when calling getConferenceRecording'
+ );
+ }
+ // verify the required parameter 'recording_id' is set
+ if ($recording_id === null || (is_array($recording_id) && count($recording_id) === 0)) {
+ throw new InvalidArgumentException(
+ 'Missing the required parameter $recording_id when calling getConferenceRecording'
+ );
+ }
+
+ $resourcePath = '/accounts/{accountId}/conferences/{conferenceId}/recordings/{recordingId}';
+ $queryParams = [];
+ $headerParams = [];
+ $httpBody = '';
+ $multipart = false;
+
+
+
+ // path params
+ if ($account_id !== null) {
+ $resourcePath = str_replace(
+ '{accountId}',
+ ObjectSerializer::toPathValue($account_id),
+ $resourcePath
+ );
+ }
+ // path params
+ if ($conference_id !== null) {
+ $resourcePath = str_replace(
+ '{conferenceId}',
+ ObjectSerializer::toPathValue($conference_id),
+ $resourcePath
+ );
+ }
+ // path params
+ if ($recording_id !== null) {
+ $resourcePath = str_replace(
+ '{recordingId}',
+ ObjectSerializer::toPathValue($recording_id),
+ $resourcePath
+ );
+ }
+
+
+ $headers = $this->headerSelector->selectHeaders(
+ ['application/json', ],
+ $contentType,
+ $multipart
+ );
+
+
+ // this endpoint requires HTTP basic authentication
+ if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) {
+ $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword());
+ }
+
+ // this endpoint requires OAuth (access token)
+ if (!empty($this->config->getAccessToken())) {
+ $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken();
+ }
+
+ $defaultHeaders = [];
+ if ($this->config->getUserAgent()) {
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
+ }
+
+ $headers = array_merge(
+ $defaultHeaders,
+ $headerParams,
+ $headers
+ );
+
+ if ($this->config->getIgnoreOperationHosts()) {
+ $operationHost = $this->config->getHost();
+ } else {
+ # Preserve the original behavior of server indexing.
+ if ($hostIndex === null) {
+ $hostIndex = $this->hostIndex;
+ }
+
+ $hostSettings = $this->getHostSettingsForgetConferenceRecording();
+
+ if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) {
+ throw new InvalidArgumentException("Invalid index {$hostIndex} when selecting the host. Must be less than ".count($hostSettings));
+ }
+ $operationHost = Configuration::getHostString($hostSettings, $hostIndex, $variables);
+ }
+ $query = ObjectSerializer::buildQuery($queryParams);
+ return new Request(
+ 'GET',
+ $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
+ $headers,
+ $httpBody
+ );
+ }
+
+ /**
+ * Returns an array of host settings for Operation getConferenceRecording
+ *
+ * @return array an array of host settings
+ */
+ protected function getHostSettingsForgetConferenceRecording(): array
+ {
+ return [
+ [
+ "url" => "https://voice.bandwidth.com/api/v2",
+ "description" => "Production",
+ ]
+ ];
+ }
+
+ /**
+ * Operation listConferenceRecordings
+ *
+ * Get Conference Recordings
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://voice.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $conference_id Programmable Voice API Conference ID. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listConferenceRecordings'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return \Bandwidth\Model\ConferenceRecordingMetadata[]|\Bandwidth\Model\VoiceApiError
+ */
+ public function listConferenceRecordings(
+ string $account_id,
+ string $conference_id,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['listConferenceRecordings'][0]
+ ): array|\Bandwidth\Model\VoiceApiError
+ {
+ list($response) = $this->listConferenceRecordingsWithHttpInfo($account_id, $conference_id, $hostIndex, $variables, $contentType);
+ return $response;
+ }
+
+ /**
+ * Operation listConferenceRecordingsWithHttpInfo
+ *
+ * Get Conference Recordings
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://voice.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $conference_id Programmable Voice API Conference ID. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listConferenceRecordings'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return array{0: \Bandwidth\Model\ConferenceRecordingMetadata[]|\Bandwidth\Model\VoiceApiError, 1: int, 2: array} [response data, HTTP status code, HTTP response headers]
+ */
+ public function listConferenceRecordingsWithHttpInfo(
+ string $account_id,
+ string $conference_id,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['listConferenceRecordings'][0]
+ ): array
+ {
+ $request = $this->listConferenceRecordingsRequest($account_id, $conference_id, $hostIndex, $variables, $contentType);
+
+ try {
+ $options = $this->createHttpClientOption();
+ try {
+ $response = $this->client->send($request, $options);
+ } catch (RequestException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
+ $e->getResponse() ? (string) $e->getResponse()->getBody() : null
+ );
+ } catch (ConnectException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ null,
+ null
+ );
+ }
+
+ $statusCode = $response->getStatusCode();
+
+ switch($statusCode) {
+ case 200:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\ConferenceRecordingMetadata[]',
+ $request,
+ $response,
+ );
+ case 400:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\VoiceApiError',
+ $request,
+ $response,
+ );
+ case 401:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\VoiceApiError',
+ $request,
+ $response,
+ );
+ case 403:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\VoiceApiError',
+ $request,
+ $response,
+ );
+ case 404:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\VoiceApiError',
+ $request,
+ $response,
+ );
+ case 405:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\VoiceApiError',
+ $request,
+ $response,
+ );
+ case 415:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\VoiceApiError',
+ $request,
+ $response,
+ );
+ case 429:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\VoiceApiError',
+ $request,
+ $response,
+ );
+ case 500:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\VoiceApiError',
+ $request,
+ $response,
+ );
+ }
+
+ if ($statusCode < 200 || $statusCode > 299) {
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ (string) $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\ConferenceRecordingMetadata[]',
+ $request,
+ $response,
+ );
+ } catch (ApiException $e) {
+ switch ($e->getCode()) {
+ case 200:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\ConferenceRecordingMetadata[]',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 400:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 401:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 403:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 404:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 405:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 415:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 429:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 500:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ }
+
+ throw $e;
+ }
+ }
+
+ /**
+ * Operation listConferenceRecordingsAsync
+ *
+ * Get Conference Recordings
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://voice.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $conference_id Programmable Voice API Conference ID. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listConferenceRecordings'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function listConferenceRecordingsAsync(
+ string $account_id,
+ string $conference_id,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['listConferenceRecordings'][0]
+ ): PromiseInterface
+ {
+ return $this->listConferenceRecordingsAsyncWithHttpInfo($account_id, $conference_id, $hostIndex, $variables, $contentType)
+ ->then(
+ function ($response) {
+ return $response[0];
+ }
+ );
+ }
+
+ /**
+ * Operation listConferenceRecordingsAsyncWithHttpInfo
+ *
+ * Get Conference Recordings
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://voice.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $conference_id Programmable Voice API Conference ID. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listConferenceRecordings'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function listConferenceRecordingsAsyncWithHttpInfo(
+ string $account_id,
+ string $conference_id,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['listConferenceRecordings'][0]
+ ): PromiseInterface
+ {
+ $returnType = '\Bandwidth\Model\ConferenceRecordingMetadata[]';
+ $request = $this->listConferenceRecordingsRequest($account_id, $conference_id, $hostIndex, $variables, $contentType);
+
+ return $this->client
+ ->sendAsync($request, $this->createHttpClientOption())
+ ->then(
+ function ($response) use ($returnType) {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ },
+ function ($exception) {
+ $response = $exception->getResponse();
+ $statusCode = $response->getStatusCode();
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ $exception->getRequest()->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+ );
+ }
+
+ /**
+ * Create request for operation 'listConferenceRecordings'
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://voice.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $conference_id Programmable Voice API Conference ID. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listConferenceRecordings'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return \GuzzleHttp\Psr7\Request
+ */
+ public function listConferenceRecordingsRequest(
+ string $account_id,
+ string $conference_id,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['listConferenceRecordings'][0]
+ ): Request
+ {
+ // verify the required parameter 'account_id' is set
+ if ($account_id === null || (is_array($account_id) && count($account_id) === 0)) {
+ throw new InvalidArgumentException(
+ 'Missing the required parameter $account_id when calling listConferenceRecordings'
+ );
+ }
+ // verify the required parameter 'conference_id' is set
+ if ($conference_id === null || (is_array($conference_id) && count($conference_id) === 0)) {
+ throw new InvalidArgumentException(
+ 'Missing the required parameter $conference_id when calling listConferenceRecordings'
+ );
+ }
+
+ $resourcePath = '/accounts/{accountId}/conferences/{conferenceId}/recordings';
+ $queryParams = [];
+ $headerParams = [];
+ $httpBody = '';
+ $multipart = false;
+
+
+
+ // path params
+ if ($account_id !== null) {
+ $resourcePath = str_replace(
+ '{accountId}',
+ ObjectSerializer::toPathValue($account_id),
+ $resourcePath
+ );
+ }
+ // path params
+ if ($conference_id !== null) {
+ $resourcePath = str_replace(
+ '{conferenceId}',
+ ObjectSerializer::toPathValue($conference_id),
+ $resourcePath
+ );
+ }
+
+
+ $headers = $this->headerSelector->selectHeaders(
+ ['application/json', ],
+ $contentType,
+ $multipart
+ );
+
+
+ // this endpoint requires HTTP basic authentication
+ if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) {
+ $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword());
+ }
+
+ // this endpoint requires OAuth (access token)
+ if (!empty($this->config->getAccessToken())) {
+ $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken();
+ }
+
+ $defaultHeaders = [];
+ if ($this->config->getUserAgent()) {
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
+ }
+
+ $headers = array_merge(
+ $defaultHeaders,
+ $headerParams,
+ $headers
+ );
+
+ if ($this->config->getIgnoreOperationHosts()) {
+ $operationHost = $this->config->getHost();
+ } else {
+ # Preserve the original behavior of server indexing.
+ if ($hostIndex === null) {
+ $hostIndex = $this->hostIndex;
+ }
+
+ $hostSettings = $this->getHostSettingsForlistConferenceRecordings();
+
+ if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) {
+ throw new InvalidArgumentException("Invalid index {$hostIndex} when selecting the host. Must be less than ".count($hostSettings));
+ }
+ $operationHost = Configuration::getHostString($hostSettings, $hostIndex, $variables);
+ }
+ $query = ObjectSerializer::buildQuery($queryParams);
+ return new Request(
+ 'GET',
+ $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
+ $headers,
+ $httpBody
+ );
+ }
+
+ /**
+ * Returns an array of host settings for Operation listConferenceRecordings
+ *
+ * @return array an array of host settings
+ */
+ protected function getHostSettingsForlistConferenceRecordings(): array
+ {
+ return [
+ [
+ "url" => "https://voice.bandwidth.com/api/v2",
+ "description" => "Production",
+ ]
+ ];
+ }
+
+ /**
+ * Operation listConferences
+ *
+ * Get Conferences
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://voice.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string|null $name Filter results by the `name` field. (optional)
+ * @param string|null $min_created_time Filter results to conferences which have a `createdTime` after or at `minCreatedTime` (in ISO8601 format). (optional)
+ * @param string|null $max_created_time Filter results to conferences which have a `createdTime` before or at `maxCreatedTime` (in ISO8601 format). (optional)
+ * @param int|null $page_size Specifies the max number of conferences that will be returned. (optional, default to 1000)
+ * @param string|null $page_token Not intended for explicit use. To use pagination, follow the links in the `Link` header of the response, as indicated in the endpoint description. (optional)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listConferences'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return \Bandwidth\Model\Conference[]|\Bandwidth\Model\VoiceApiError
+ */
+ public function listConferences(
+ string $account_id,
+ ?string $name = null,
+ ?string $min_created_time = null,
+ ?string $max_created_time = null,
+ ?int $page_size = 1000,
+ ?string $page_token = null,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['listConferences'][0]
+ ): array|\Bandwidth\Model\VoiceApiError
+ {
+ list($response) = $this->listConferencesWithHttpInfo($account_id, $name, $min_created_time, $max_created_time, $page_size, $page_token, $hostIndex, $variables, $contentType);
+ return $response;
+ }
+
+ /**
+ * Operation listConferencesWithHttpInfo
+ *
+ * Get Conferences
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://voice.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string|null $name Filter results by the `name` field. (optional)
+ * @param string|null $min_created_time Filter results to conferences which have a `createdTime` after or at `minCreatedTime` (in ISO8601 format). (optional)
+ * @param string|null $max_created_time Filter results to conferences which have a `createdTime` before or at `maxCreatedTime` (in ISO8601 format). (optional)
+ * @param int|null $page_size Specifies the max number of conferences that will be returned. (optional, default to 1000)
+ * @param string|null $page_token Not intended for explicit use. To use pagination, follow the links in the `Link` header of the response, as indicated in the endpoint description. (optional)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listConferences'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return array{0: \Bandwidth\Model\Conference[]|\Bandwidth\Model\VoiceApiError, 1: int, 2: array} [response data, HTTP status code, HTTP response headers]
+ */
+ public function listConferencesWithHttpInfo(
+ string $account_id,
+ ?string $name = null,
+ ?string $min_created_time = null,
+ ?string $max_created_time = null,
+ ?int $page_size = 1000,
+ ?string $page_token = null,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['listConferences'][0]
+ ): array
+ {
+ $request = $this->listConferencesRequest($account_id, $name, $min_created_time, $max_created_time, $page_size, $page_token, $hostIndex, $variables, $contentType);
+
+ try {
+ $options = $this->createHttpClientOption();
+ try {
+ $response = $this->client->send($request, $options);
+ } catch (RequestException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
+ $e->getResponse() ? (string) $e->getResponse()->getBody() : null
+ );
+ } catch (ConnectException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ null,
+ null
+ );
+ }
+
+ $statusCode = $response->getStatusCode();
+
+ switch($statusCode) {
+ case 200:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\Conference[]',
+ $request,
+ $response,
+ );
+ case 400:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\VoiceApiError',
+ $request,
+ $response,
+ );
+ case 401:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\VoiceApiError',
+ $request,
+ $response,
+ );
+ case 403:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\VoiceApiError',
+ $request,
+ $response,
+ );
+ case 404:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\VoiceApiError',
+ $request,
+ $response,
+ );
+ case 405:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\VoiceApiError',
+ $request,
+ $response,
+ );
+ case 415:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\VoiceApiError',
+ $request,
+ $response,
+ );
+ case 429:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\VoiceApiError',
+ $request,
+ $response,
+ );
+ case 500:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\VoiceApiError',
+ $request,
+ $response,
+ );
+ }
+
+ if ($statusCode < 200 || $statusCode > 299) {
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ (string) $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\Conference[]',
+ $request,
+ $response,
+ );
+ } catch (ApiException $e) {
+ switch ($e->getCode()) {
+ case 200:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\Conference[]',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 400:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 401:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 403:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 404:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 405:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 415:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 429:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 500:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ }
+
+ throw $e;
+ }
+ }
+
+ /**
+ * Operation listConferencesAsync
+ *
+ * Get Conferences
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://voice.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string|null $name Filter results by the `name` field. (optional)
+ * @param string|null $min_created_time Filter results to conferences which have a `createdTime` after or at `minCreatedTime` (in ISO8601 format). (optional)
+ * @param string|null $max_created_time Filter results to conferences which have a `createdTime` before or at `maxCreatedTime` (in ISO8601 format). (optional)
+ * @param int|null $page_size Specifies the max number of conferences that will be returned. (optional, default to 1000)
+ * @param string|null $page_token Not intended for explicit use. To use pagination, follow the links in the `Link` header of the response, as indicated in the endpoint description. (optional)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listConferences'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function listConferencesAsync(
+ string $account_id,
+ ?string $name = null,
+ ?string $min_created_time = null,
+ ?string $max_created_time = null,
+ ?int $page_size = 1000,
+ ?string $page_token = null,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['listConferences'][0]
+ ): PromiseInterface
+ {
+ return $this->listConferencesAsyncWithHttpInfo($account_id, $name, $min_created_time, $max_created_time, $page_size, $page_token, $hostIndex, $variables, $contentType)
+ ->then(
+ function ($response) {
+ return $response[0];
+ }
+ );
+ }
+
+ /**
+ * Operation listConferencesAsyncWithHttpInfo
+ *
+ * Get Conferences
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://voice.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string|null $name Filter results by the `name` field. (optional)
+ * @param string|null $min_created_time Filter results to conferences which have a `createdTime` after or at `minCreatedTime` (in ISO8601 format). (optional)
+ * @param string|null $max_created_time Filter results to conferences which have a `createdTime` before or at `maxCreatedTime` (in ISO8601 format). (optional)
+ * @param int|null $page_size Specifies the max number of conferences that will be returned. (optional, default to 1000)
+ * @param string|null $page_token Not intended for explicit use. To use pagination, follow the links in the `Link` header of the response, as indicated in the endpoint description. (optional)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listConferences'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function listConferencesAsyncWithHttpInfo(
+ string $account_id,
+ ?string $name = null,
+ ?string $min_created_time = null,
+ ?string $max_created_time = null,
+ ?int $page_size = 1000,
+ ?string $page_token = null,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['listConferences'][0]
+ ): PromiseInterface
+ {
+ $returnType = '\Bandwidth\Model\Conference[]';
+ $request = $this->listConferencesRequest($account_id, $name, $min_created_time, $max_created_time, $page_size, $page_token, $hostIndex, $variables, $contentType);
+
+ return $this->client
+ ->sendAsync($request, $this->createHttpClientOption())
+ ->then(
+ function ($response) use ($returnType) {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ },
+ function ($exception) {
+ $response = $exception->getResponse();
+ $statusCode = $response->getStatusCode();
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ $exception->getRequest()->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+ );
+ }
+
+ /**
+ * Create request for operation 'listConferences'
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://voice.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string|null $name Filter results by the `name` field. (optional)
+ * @param string|null $min_created_time Filter results to conferences which have a `createdTime` after or at `minCreatedTime` (in ISO8601 format). (optional)
+ * @param string|null $max_created_time Filter results to conferences which have a `createdTime` before or at `maxCreatedTime` (in ISO8601 format). (optional)
+ * @param int|null $page_size Specifies the max number of conferences that will be returned. (optional, default to 1000)
+ * @param string|null $page_token Not intended for explicit use. To use pagination, follow the links in the `Link` header of the response, as indicated in the endpoint description. (optional)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listConferences'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return \GuzzleHttp\Psr7\Request
+ */
+ public function listConferencesRequest(
+ string $account_id,
+ ?string $name = null,
+ ?string $min_created_time = null,
+ ?string $max_created_time = null,
+ ?int $page_size = 1000,
+ ?string $page_token = null,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['listConferences'][0]
+ ): Request
+ {
+ // verify the required parameter 'account_id' is set
+ if ($account_id === null || (is_array($account_id) && count($account_id) === 0)) {
+ throw new InvalidArgumentException(
+ 'Missing the required parameter $account_id when calling listConferences'
+ );
+ }
+ if ($page_size !== null && $page_size > 1000) {
+ throw new InvalidArgumentException('invalid value for "$page_size" when calling ConferencesApi.listConferences, must be smaller than or equal to 1000.');
+ }
+ if ($page_size !== null && $page_size < 1) {
+ throw new InvalidArgumentException('invalid value for "$page_size" when calling ConferencesApi.listConferences, must be bigger than or equal to 1.');
+ }
+
+ $resourcePath = '/accounts/{accountId}/conferences';
+ $queryParams = [];
+ $headerParams = [];
+ $httpBody = '';
+ $multipart = false;
+
+ // query params
+ $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+ $name,
+ 'name', // param base name
+ 'string', // openApiType
+ 'form', // style
+ true, // explode
+ false // required
+ ) ?? []);
+ // query params
+ $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+ $min_created_time,
+ 'minCreatedTime', // param base name
+ 'string', // openApiType
+ 'form', // style
+ true, // explode
+ false // required
+ ) ?? []);
+ // query params
+ $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+ $max_created_time,
+ 'maxCreatedTime', // param base name
+ 'string', // openApiType
+ 'form', // style
+ true, // explode
+ false // required
+ ) ?? []);
+ // query params
+ $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+ $page_size,
+ 'pageSize', // param base name
+ 'integer', // openApiType
+ 'form', // style
+ true, // explode
+ false // required
+ ) ?? []);
+ // query params
+ $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+ $page_token,
+ 'pageToken', // param base name
+ 'string', // openApiType
+ 'form', // style
+ true, // explode
+ false // required
+ ) ?? []);
+
+
+ // path params
+ if ($account_id !== null) {
+ $resourcePath = str_replace(
+ '{accountId}',
+ ObjectSerializer::toPathValue($account_id),
+ $resourcePath
+ );
+ }
+
+
+ $headers = $this->headerSelector->selectHeaders(
+ ['application/json', ],
+ $contentType,
+ $multipart
+ );
+
+
+ // this endpoint requires HTTP basic authentication
+ if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) {
+ $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword());
+ }
+
+ // this endpoint requires OAuth (access token)
+ if (!empty($this->config->getAccessToken())) {
+ $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken();
+ }
+
+ $defaultHeaders = [];
+ if ($this->config->getUserAgent()) {
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
+ }
+
+ $headers = array_merge(
+ $defaultHeaders,
+ $headerParams,
+ $headers
+ );
+
+ if ($this->config->getIgnoreOperationHosts()) {
+ $operationHost = $this->config->getHost();
+ } else {
+ # Preserve the original behavior of server indexing.
+ if ($hostIndex === null) {
+ $hostIndex = $this->hostIndex;
+ }
+
+ $hostSettings = $this->getHostSettingsForlistConferences();
+
+ if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) {
+ throw new InvalidArgumentException("Invalid index {$hostIndex} when selecting the host. Must be less than ".count($hostSettings));
+ }
+ $operationHost = Configuration::getHostString($hostSettings, $hostIndex, $variables);
+ }
+ $query = ObjectSerializer::buildQuery($queryParams);
+ return new Request(
+ 'GET',
+ $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
+ $headers,
+ $httpBody
+ );
+ }
+
+ /**
+ * Returns an array of host settings for Operation listConferences
+ *
+ * @return array an array of host settings
+ */
+ protected function getHostSettingsForlistConferences(): array
+ {
+ return [
+ [
+ "url" => "https://voice.bandwidth.com/api/v2",
+ "description" => "Production",
+ ]
+ ];
+ }
+
+ /**
+ * Operation updateConference
+ *
+ * Update Conference
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://voice.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $conference_id Programmable Voice API Conference ID. (required)
+ * @param \Bandwidth\Model\UpdateConference $update_conference update_conference (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateConference'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return \Bandwidth\Model\VoiceApiError|null
+ */
+ public function updateConference(
+ string $account_id,
+ string $conference_id,
+ \Bandwidth\Model\UpdateConference $update_conference,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['updateConference'][0]
+ ): ?\Bandwidth\Model\VoiceApiError
+ {
+ list($response) = $this->updateConferenceWithHttpInfo($account_id, $conference_id, $update_conference, $hostIndex, $variables, $contentType);
+ return $response;
+ }
+
+ /**
+ * Operation updateConferenceWithHttpInfo
+ *
+ * Update Conference
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://voice.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $conference_id Programmable Voice API Conference ID. (required)
+ * @param \Bandwidth\Model\UpdateConference $update_conference (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateConference'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return array{0: null, 1: int, 2: array} [response data, HTTP status code, HTTP response headers]
+ */
+ public function updateConferenceWithHttpInfo(
+ string $account_id,
+ string $conference_id,
+ \Bandwidth\Model\UpdateConference $update_conference,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['updateConference'][0]
+ ): array
+ {
+ $request = $this->updateConferenceRequest($account_id, $conference_id, $update_conference, $hostIndex, $variables, $contentType);
+
+ try {
+ $options = $this->createHttpClientOption();
+ try {
+ $response = $this->client->send($request, $options);
+ } catch (RequestException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
+ $e->getResponse() ? (string) $e->getResponse()->getBody() : null
+ );
+ } catch (ConnectException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ null,
+ null
+ );
+ }
+
+ $statusCode = $response->getStatusCode();
+
+
+ return [null, $statusCode, $response->getHeaders()];
+ } catch (ApiException $e) {
+ switch ($e->getCode()) {
+ case 400:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 401:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 403:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 404:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 405:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 415:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 429:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 500:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ }
+
+ throw $e;
+ }
+ }
+
+ /**
+ * Operation updateConferenceAsync
+ *
+ * Update Conference
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://voice.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $conference_id Programmable Voice API Conference ID. (required)
+ * @param \Bandwidth\Model\UpdateConference $update_conference (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateConference'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function updateConferenceAsync(
+ string $account_id,
+ string $conference_id,
+ \Bandwidth\Model\UpdateConference $update_conference,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['updateConference'][0]
+ ): PromiseInterface
+ {
+ return $this->updateConferenceAsyncWithHttpInfo($account_id, $conference_id, $update_conference, $hostIndex, $variables, $contentType)
+ ->then(
+ function ($response) {
+ return $response[0];
+ }
+ );
+ }
+
+ /**
+ * Operation updateConferenceAsyncWithHttpInfo
+ *
+ * Update Conference
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://voice.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $conference_id Programmable Voice API Conference ID. (required)
+ * @param \Bandwidth\Model\UpdateConference $update_conference (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateConference'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function updateConferenceAsyncWithHttpInfo(
+ string $account_id,
+ string $conference_id,
+ \Bandwidth\Model\UpdateConference $update_conference,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['updateConference'][0]
+ ): PromiseInterface
+ {
+ $returnType = '';
+ $request = $this->updateConferenceRequest($account_id, $conference_id, $update_conference, $hostIndex, $variables, $contentType);
+
+ return $this->client
+ ->sendAsync($request, $this->createHttpClientOption())
+ ->then(
+ function ($response) use ($returnType) {
+ return [null, $response->getStatusCode(), $response->getHeaders()];
+ },
+ function ($exception) {
+ $response = $exception->getResponse();
+ $statusCode = $response->getStatusCode();
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ $exception->getRequest()->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+ );
+ }
+
+ /**
+ * Create request for operation 'updateConference'
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://voice.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $conference_id Programmable Voice API Conference ID. (required)
+ * @param \Bandwidth\Model\UpdateConference $update_conference (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateConference'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return \GuzzleHttp\Psr7\Request
+ */
+ public function updateConferenceRequest(
+ string $account_id,
+ string $conference_id,
+ \Bandwidth\Model\UpdateConference $update_conference,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['updateConference'][0]
+ ): Request
+ {
+ // verify the required parameter 'account_id' is set
+ if ($account_id === null || (is_array($account_id) && count($account_id) === 0)) {
+ throw new InvalidArgumentException(
+ 'Missing the required parameter $account_id when calling updateConference'
+ );
+ }
+ // verify the required parameter 'conference_id' is set
+ if ($conference_id === null || (is_array($conference_id) && count($conference_id) === 0)) {
+ throw new InvalidArgumentException(
+ 'Missing the required parameter $conference_id when calling updateConference'
+ );
+ }
+ // verify the required parameter 'update_conference' is set
+ if ($update_conference === null || (is_array($update_conference) && count($update_conference) === 0)) {
+ throw new InvalidArgumentException(
+ 'Missing the required parameter $update_conference when calling updateConference'
+ );
+ }
+
+ $resourcePath = '/accounts/{accountId}/conferences/{conferenceId}';
+ $formParams = [];
+ $queryParams = [];
+ $headerParams = [];
+ $httpBody = '';
+ $multipart = false;
+
+
+
+ // path params
+ if ($account_id !== null) {
+ $resourcePath = str_replace(
+ '{accountId}',
+ ObjectSerializer::toPathValue($account_id),
+ $resourcePath
+ );
+ }
+ // path params
+ if ($conference_id !== null) {
+ $resourcePath = str_replace(
+ '{conferenceId}',
+ ObjectSerializer::toPathValue($conference_id),
+ $resourcePath
+ );
+ }
+
+
+ $headers = $this->headerSelector->selectHeaders(
+ ['application/json', ],
+ $contentType,
+ $multipart
+ );
+
+ // for model (json/xml)
+ if (isset($update_conference)) {
+ if (stripos($headers['Content-Type'], 'application/json') !== false) {
+ # if Content-Type contains "application/json", json_encode the body
+ $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($update_conference));
+ } else {
+ $httpBody = $update_conference;
+ }
+ } elseif (count($formParams) > 0) {
+ if ($multipart) {
+ $multipartContents = [];
+ foreach ($formParams as $formParamName => $formParamValue) {
+ $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
+ foreach ($formParamValueItems as $formParamValueItem) {
+ $multipartContents[] = [
+ 'name' => $formParamName,
+ 'contents' => $formParamValueItem
+ ];
+ }
+ }
+ // for HTTP post (form)
+ $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents);
+
+ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
+ # if Content-Type contains "application/json", json_encode the form parameters
+ $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams);
+ } else {
+ // for HTTP post (form)
+ $httpBody = ObjectSerializer::buildQuery($formParams);
+ }
+ }
+
+ // this endpoint requires HTTP basic authentication
+ if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) {
+ $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword());
+ }
+
+ // this endpoint requires OAuth (access token)
+ if (!empty($this->config->getAccessToken())) {
+ $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken();
+ }
+
+ $defaultHeaders = [];
+ if ($this->config->getUserAgent()) {
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
+ }
+
+ $headers = array_merge(
+ $defaultHeaders,
+ $headerParams,
+ $headers
+ );
+
+ if ($this->config->getIgnoreOperationHosts()) {
+ $operationHost = $this->config->getHost();
+ } else {
+ # Preserve the original behavior of server indexing.
+ if ($hostIndex === null) {
+ $hostIndex = $this->hostIndex;
+ }
+
+ $hostSettings = $this->getHostSettingsForupdateConference();
+
+ if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) {
+ throw new InvalidArgumentException("Invalid index {$hostIndex} when selecting the host. Must be less than ".count($hostSettings));
+ }
+ $operationHost = Configuration::getHostString($hostSettings, $hostIndex, $variables);
+ }
+ $query = ObjectSerializer::buildQuery($queryParams);
+ return new Request(
+ 'POST',
+ $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
+ $headers,
+ $httpBody
+ );
+ }
+
+ /**
+ * Returns an array of host settings for Operation updateConference
+ *
+ * @return array an array of host settings
+ */
+ protected function getHostSettingsForupdateConference(): array
+ {
+ return [
+ [
+ "url" => "https://voice.bandwidth.com/api/v2",
+ "description" => "Production",
+ ]
+ ];
+ }
+
+ /**
+ * Operation updateConferenceBxml
+ *
+ * Update Conference BXML
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://voice.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $conference_id Programmable Voice API Conference ID. (required)
+ * @param string $body body (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateConferenceBxml'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return \Bandwidth\Model\VoiceApiError|null
+ */
+ public function updateConferenceBxml(
+ string $account_id,
+ string $conference_id,
+ string $body,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['updateConferenceBxml'][0]
+ ): ?\Bandwidth\Model\VoiceApiError
+ {
+ list($response) = $this->updateConferenceBxmlWithHttpInfo($account_id, $conference_id, $body, $hostIndex, $variables, $contentType);
+ return $response;
+ }
+
+ /**
+ * Operation updateConferenceBxmlWithHttpInfo
+ *
+ * Update Conference BXML
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://voice.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $conference_id Programmable Voice API Conference ID. (required)
+ * @param string $body (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateConferenceBxml'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return array{0: null, 1: int, 2: array} [response data, HTTP status code, HTTP response headers]
+ */
+ public function updateConferenceBxmlWithHttpInfo(
+ string $account_id,
+ string $conference_id,
+ string $body,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['updateConferenceBxml'][0]
+ ): array
+ {
+ $request = $this->updateConferenceBxmlRequest($account_id, $conference_id, $body, $hostIndex, $variables, $contentType);
+
+ try {
+ $options = $this->createHttpClientOption();
+ try {
+ $response = $this->client->send($request, $options);
+ } catch (RequestException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
+ $e->getResponse() ? (string) $e->getResponse()->getBody() : null
+ );
+ } catch (ConnectException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ null,
+ null
+ );
+ }
+
+ $statusCode = $response->getStatusCode();
+
+
+ return [null, $statusCode, $response->getHeaders()];
+ } catch (ApiException $e) {
+ switch ($e->getCode()) {
+ case 400:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 401:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 403:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 404:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 405:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 415:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 429:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 500:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ }
+
+ throw $e;
+ }
+ }
+
+ /**
+ * Operation updateConferenceBxmlAsync
+ *
+ * Update Conference BXML
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://voice.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $conference_id Programmable Voice API Conference ID. (required)
+ * @param string $body (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateConferenceBxml'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function updateConferenceBxmlAsync(
+ string $account_id,
+ string $conference_id,
+ string $body,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['updateConferenceBxml'][0]
+ ): PromiseInterface
+ {
+ return $this->updateConferenceBxmlAsyncWithHttpInfo($account_id, $conference_id, $body, $hostIndex, $variables, $contentType)
+ ->then(
+ function ($response) {
+ return $response[0];
+ }
+ );
+ }
+
+ /**
+ * Operation updateConferenceBxmlAsyncWithHttpInfo
+ *
+ * Update Conference BXML
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://voice.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $conference_id Programmable Voice API Conference ID. (required)
+ * @param string $body (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateConferenceBxml'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function updateConferenceBxmlAsyncWithHttpInfo(
+ string $account_id,
+ string $conference_id,
+ string $body,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['updateConferenceBxml'][0]
+ ): PromiseInterface
+ {
+ $returnType = '';
+ $request = $this->updateConferenceBxmlRequest($account_id, $conference_id, $body, $hostIndex, $variables, $contentType);
+
+ return $this->client
+ ->sendAsync($request, $this->createHttpClientOption())
+ ->then(
+ function ($response) use ($returnType) {
+ return [null, $response->getStatusCode(), $response->getHeaders()];
+ },
+ function ($exception) {
+ $response = $exception->getResponse();
+ $statusCode = $response->getStatusCode();
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ $exception->getRequest()->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+ );
+ }
+
+ /**
+ * Create request for operation 'updateConferenceBxml'
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://voice.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $conference_id Programmable Voice API Conference ID. (required)
+ * @param string $body (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateConferenceBxml'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return \GuzzleHttp\Psr7\Request
+ */
+ public function updateConferenceBxmlRequest(
+ string $account_id,
+ string $conference_id,
+ string $body,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['updateConferenceBxml'][0]
+ ): Request
+ {
+ // verify the required parameter 'account_id' is set
+ if ($account_id === null || (is_array($account_id) && count($account_id) === 0)) {
+ throw new InvalidArgumentException(
+ 'Missing the required parameter $account_id when calling updateConferenceBxml'
+ );
+ }
+ // verify the required parameter 'conference_id' is set
+ if ($conference_id === null || (is_array($conference_id) && count($conference_id) === 0)) {
+ throw new InvalidArgumentException(
+ 'Missing the required parameter $conference_id when calling updateConferenceBxml'
+ );
+ }
+ // verify the required parameter 'body' is set
+ if ($body === null || (is_array($body) && count($body) === 0)) {
+ throw new InvalidArgumentException(
+ 'Missing the required parameter $body when calling updateConferenceBxml'
+ );
+ }
+
+ $resourcePath = '/accounts/{accountId}/conferences/{conferenceId}/bxml';
+ $formParams = [];
+ $queryParams = [];
+ $headerParams = [];
+ $httpBody = '';
+ $multipart = false;
+
+
+
+ // path params
+ if ($account_id !== null) {
+ $resourcePath = str_replace(
+ '{accountId}',
+ ObjectSerializer::toPathValue($account_id),
+ $resourcePath
+ );
+ }
+ // path params
+ if ($conference_id !== null) {
+ $resourcePath = str_replace(
+ '{conferenceId}',
+ ObjectSerializer::toPathValue($conference_id),
+ $resourcePath
+ );
+ }
+
+
+ $headers = $this->headerSelector->selectHeaders(
+ ['application/json', ],
+ $contentType,
+ $multipart
+ );
+
+ // for model (json/xml)
+ if (isset($body)) {
+ if (stripos($headers['Content-Type'], 'application/json') !== false) {
+ # if Content-Type contains "application/json", json_encode the body
+ $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($body));
+ } else {
+ $httpBody = $body;
+ }
+ } elseif (count($formParams) > 0) {
+ if ($multipart) {
+ $multipartContents = [];
+ foreach ($formParams as $formParamName => $formParamValue) {
+ $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
+ foreach ($formParamValueItems as $formParamValueItem) {
+ $multipartContents[] = [
+ 'name' => $formParamName,
+ 'contents' => $formParamValueItem
+ ];
+ }
+ }
+ // for HTTP post (form)
+ $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents);
+
+ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
+ # if Content-Type contains "application/json", json_encode the form parameters
+ $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams);
+ } else {
+ // for HTTP post (form)
+ $httpBody = ObjectSerializer::buildQuery($formParams);
+ }
+ }
+
+ // this endpoint requires HTTP basic authentication
+ if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) {
+ $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword());
+ }
+
+ // this endpoint requires OAuth (access token)
+ if (!empty($this->config->getAccessToken())) {
+ $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken();
+ }
+
+ $defaultHeaders = [];
+ if ($this->config->getUserAgent()) {
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
+ }
+
+ $headers = array_merge(
+ $defaultHeaders,
+ $headerParams,
+ $headers
+ );
+
+ if ($this->config->getIgnoreOperationHosts()) {
+ $operationHost = $this->config->getHost();
+ } else {
+ # Preserve the original behavior of server indexing.
+ if ($hostIndex === null) {
+ $hostIndex = $this->hostIndex;
+ }
+
+ $hostSettings = $this->getHostSettingsForupdateConferenceBxml();
+
+ if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) {
+ throw new InvalidArgumentException("Invalid index {$hostIndex} when selecting the host. Must be less than ".count($hostSettings));
+ }
+ $operationHost = Configuration::getHostString($hostSettings, $hostIndex, $variables);
+ }
+ $query = ObjectSerializer::buildQuery($queryParams);
+ return new Request(
+ 'PUT',
+ $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
+ $headers,
+ $httpBody
+ );
+ }
+
+ /**
+ * Returns an array of host settings for Operation updateConferenceBxml
+ *
+ * @return array an array of host settings
+ */
+ protected function getHostSettingsForupdateConferenceBxml(): array
+ {
+ return [
+ [
+ "url" => "https://voice.bandwidth.com/api/v2",
+ "description" => "Production",
+ ]
+ ];
+ }
+
+ /**
+ * Operation updateConferenceMember
+ *
+ * Update Conference Member
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://voice.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $conference_id Programmable Voice API Conference ID. (required)
+ * @param string $member_id Programmable Voice API Conference Member ID. (required)
+ * @param \Bandwidth\Model\UpdateConferenceMember $update_conference_member update_conference_member (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateConferenceMember'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return \Bandwidth\Model\VoiceApiError|null
+ */
+ public function updateConferenceMember(
+ string $account_id,
+ string $conference_id,
+ string $member_id,
+ \Bandwidth\Model\UpdateConferenceMember $update_conference_member,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['updateConferenceMember'][0]
+ ): ?\Bandwidth\Model\VoiceApiError
+ {
+ list($response) = $this->updateConferenceMemberWithHttpInfo($account_id, $conference_id, $member_id, $update_conference_member, $hostIndex, $variables, $contentType);
+ return $response;
+ }
+
+ /**
+ * Operation updateConferenceMemberWithHttpInfo
+ *
+ * Update Conference Member
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://voice.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $conference_id Programmable Voice API Conference ID. (required)
+ * @param string $member_id Programmable Voice API Conference Member ID. (required)
+ * @param \Bandwidth\Model\UpdateConferenceMember $update_conference_member (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateConferenceMember'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return array{0: null, 1: int, 2: array} [response data, HTTP status code, HTTP response headers]
+ */
+ public function updateConferenceMemberWithHttpInfo(
+ string $account_id,
+ string $conference_id,
+ string $member_id,
+ \Bandwidth\Model\UpdateConferenceMember $update_conference_member,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['updateConferenceMember'][0]
+ ): array
+ {
+ $request = $this->updateConferenceMemberRequest($account_id, $conference_id, $member_id, $update_conference_member, $hostIndex, $variables, $contentType);
+
+ try {
+ $options = $this->createHttpClientOption();
+ try {
+ $response = $this->client->send($request, $options);
+ } catch (RequestException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
+ $e->getResponse() ? (string) $e->getResponse()->getBody() : null
+ );
+ } catch (ConnectException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ null,
+ null
+ );
+ }
+
+ $statusCode = $response->getStatusCode();
+
+
+ return [null, $statusCode, $response->getHeaders()];
+ } catch (ApiException $e) {
+ switch ($e->getCode()) {
+ case 400:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 401:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 403:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 404:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 405:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 415:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 429:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 500:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ }
+
+ throw $e;
+ }
+ }
+
+ /**
+ * Operation updateConferenceMemberAsync
+ *
+ * Update Conference Member
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://voice.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $conference_id Programmable Voice API Conference ID. (required)
+ * @param string $member_id Programmable Voice API Conference Member ID. (required)
+ * @param \Bandwidth\Model\UpdateConferenceMember $update_conference_member (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateConferenceMember'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function updateConferenceMemberAsync(
+ string $account_id,
+ string $conference_id,
+ string $member_id,
+ \Bandwidth\Model\UpdateConferenceMember $update_conference_member,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['updateConferenceMember'][0]
+ ): PromiseInterface
+ {
+ return $this->updateConferenceMemberAsyncWithHttpInfo($account_id, $conference_id, $member_id, $update_conference_member, $hostIndex, $variables, $contentType)
+ ->then(
+ function ($response) {
+ return $response[0];
+ }
+ );
+ }
+
+ /**
+ * Operation updateConferenceMemberAsyncWithHttpInfo
+ *
+ * Update Conference Member
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://voice.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $conference_id Programmable Voice API Conference ID. (required)
+ * @param string $member_id Programmable Voice API Conference Member ID. (required)
+ * @param \Bandwidth\Model\UpdateConferenceMember $update_conference_member (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateConferenceMember'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function updateConferenceMemberAsyncWithHttpInfo(
+ string $account_id,
+ string $conference_id,
+ string $member_id,
+ \Bandwidth\Model\UpdateConferenceMember $update_conference_member,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['updateConferenceMember'][0]
+ ): PromiseInterface
+ {
+ $returnType = '';
+ $request = $this->updateConferenceMemberRequest($account_id, $conference_id, $member_id, $update_conference_member, $hostIndex, $variables, $contentType);
+
+ return $this->client
+ ->sendAsync($request, $this->createHttpClientOption())
+ ->then(
+ function ($response) use ($returnType) {
+ return [null, $response->getStatusCode(), $response->getHeaders()];
+ },
+ function ($exception) {
+ $response = $exception->getResponse();
+ $statusCode = $response->getStatusCode();
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ $exception->getRequest()->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+ );
+ }
+
+ /**
+ * Create request for operation 'updateConferenceMember'
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://voice.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $conference_id Programmable Voice API Conference ID. (required)
+ * @param string $member_id Programmable Voice API Conference Member ID. (required)
+ * @param \Bandwidth\Model\UpdateConferenceMember $update_conference_member (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateConferenceMember'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return \GuzzleHttp\Psr7\Request
+ */
+ public function updateConferenceMemberRequest(
+ string $account_id,
+ string $conference_id,
+ string $member_id,
+ \Bandwidth\Model\UpdateConferenceMember $update_conference_member,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['updateConferenceMember'][0]
+ ): Request
+ {
+ // verify the required parameter 'account_id' is set
+ if ($account_id === null || (is_array($account_id) && count($account_id) === 0)) {
+ throw new InvalidArgumentException(
+ 'Missing the required parameter $account_id when calling updateConferenceMember'
+ );
+ }
+ // verify the required parameter 'conference_id' is set
+ if ($conference_id === null || (is_array($conference_id) && count($conference_id) === 0)) {
+ throw new InvalidArgumentException(
+ 'Missing the required parameter $conference_id when calling updateConferenceMember'
+ );
+ }
+ // verify the required parameter 'member_id' is set
+ if ($member_id === null || (is_array($member_id) && count($member_id) === 0)) {
+ throw new InvalidArgumentException(
+ 'Missing the required parameter $member_id when calling updateConferenceMember'
+ );
+ }
+ // verify the required parameter 'update_conference_member' is set
+ if ($update_conference_member === null || (is_array($update_conference_member) && count($update_conference_member) === 0)) {
+ throw new InvalidArgumentException(
+ 'Missing the required parameter $update_conference_member when calling updateConferenceMember'
+ );
+ }
+
+ $resourcePath = '/accounts/{accountId}/conferences/{conferenceId}/members/{memberId}';
+ $formParams = [];
+ $queryParams = [];
+ $headerParams = [];
+ $httpBody = '';
+ $multipart = false;
+
+
+
+ // path params
+ if ($account_id !== null) {
+ $resourcePath = str_replace(
+ '{accountId}',
+ ObjectSerializer::toPathValue($account_id),
+ $resourcePath
+ );
+ }
+ // path params
+ if ($conference_id !== null) {
+ $resourcePath = str_replace(
+ '{conferenceId}',
+ ObjectSerializer::toPathValue($conference_id),
+ $resourcePath
+ );
+ }
+ // path params
+ if ($member_id !== null) {
+ $resourcePath = str_replace(
+ '{memberId}',
+ ObjectSerializer::toPathValue($member_id),
+ $resourcePath
+ );
+ }
+
+
+ $headers = $this->headerSelector->selectHeaders(
+ ['application/json', ],
+ $contentType,
+ $multipart
+ );
+
+ // for model (json/xml)
+ if (isset($update_conference_member)) {
+ if (stripos($headers['Content-Type'], 'application/json') !== false) {
+ # if Content-Type contains "application/json", json_encode the body
+ $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($update_conference_member));
+ } else {
+ $httpBody = $update_conference_member;
+ }
+ } elseif (count($formParams) > 0) {
+ if ($multipart) {
+ $multipartContents = [];
+ foreach ($formParams as $formParamName => $formParamValue) {
+ $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
+ foreach ($formParamValueItems as $formParamValueItem) {
+ $multipartContents[] = [
+ 'name' => $formParamName,
+ 'contents' => $formParamValueItem
+ ];
+ }
+ }
+ // for HTTP post (form)
+ $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents);
+
+ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
+ # if Content-Type contains "application/json", json_encode the form parameters
+ $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams);
+ } else {
+ // for HTTP post (form)
+ $httpBody = ObjectSerializer::buildQuery($formParams);
+ }
+ }
+
+ // this endpoint requires HTTP basic authentication
+ if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) {
+ $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword());
+ }
+
+ // this endpoint requires OAuth (access token)
+ if (!empty($this->config->getAccessToken())) {
+ $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken();
+ }
+
+ $defaultHeaders = [];
+ if ($this->config->getUserAgent()) {
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
+ }
+
+ $headers = array_merge(
+ $defaultHeaders,
+ $headerParams,
+ $headers
+ );
+
+ if ($this->config->getIgnoreOperationHosts()) {
+ $operationHost = $this->config->getHost();
+ } else {
+ # Preserve the original behavior of server indexing.
+ if ($hostIndex === null) {
+ $hostIndex = $this->hostIndex;
+ }
+
+ $hostSettings = $this->getHostSettingsForupdateConferenceMember();
+
+ if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) {
+ throw new InvalidArgumentException("Invalid index {$hostIndex} when selecting the host. Must be less than ".count($hostSettings));
+ }
+ $operationHost = Configuration::getHostString($hostSettings, $hostIndex, $variables);
+ }
+ $query = ObjectSerializer::buildQuery($queryParams);
+ return new Request(
+ 'PUT',
+ $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
+ $headers,
+ $httpBody
+ );
+ }
+
+ /**
+ * Returns an array of host settings for Operation updateConferenceMember
+ *
+ * @return array an array of host settings
+ */
+ protected function getHostSettingsForupdateConferenceMember(): array
+ {
+ return [
+ [
+ "url" => "https://voice.bandwidth.com/api/v2",
+ "description" => "Production",
+ ]
+ ];
+ }
+
+ /**
+ * Create http client option
+ *
+ * @throws \RuntimeException on file opening failure
+ * @return array of http client options
+ */
+ protected function createHttpClientOption(): array
+ {
+ $options = [];
+ if ($this->config->getDebug()) {
+ $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a');
+ if (!$options[RequestOptions::DEBUG]) {
+ throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile());
+ }
+ }
+
+ return $options;
+ }
+
+ private function handleResponseWithDataType(
+ string $dataType,
+ RequestInterface $request,
+ ResponseInterface $response,
+ ): array {
+ if (in_array($dataType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($dataType !== 'string') {
+ try {
+ $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR);
+ } catch (\JsonException $exception) {
+ throw new ApiException(
+ sprintf(
+ 'Error JSON decoding server response (%s)',
+ $request->getUri()
+ ),
+ $response->getStatusCode(),
+ $response->getHeaders(),
+ $content
+ );
+ }
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $dataType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ }
+
+ private function responseWithinRangeCode(
+ string $rangeCode,
+ int $statusCode,
+ ): bool {
+ $left = (int) ($rangeCode[0].'00');
+ $right = (int) ($rangeCode[0].'99');
+
+ return $statusCode >= $left && $statusCode <= $right;
+ }
+}
diff --git a/src/Api/EndpointsApi.php b/src/Api/EndpointsApi.php
new file mode 100644
index 0000000..30ee44c
--- /dev/null
+++ b/src/Api/EndpointsApi.php
@@ -0,0 +1,2472 @@
+ $contentTypes **/
+ public const contentTypes = [
+ 'createEndpoint' => [
+ 'application/json',
+ ],
+ 'deleteEndpoint' => [
+ 'application/json',
+ ],
+ 'getEndpoint' => [
+ 'application/json',
+ ],
+ 'listEndpoints' => [
+ 'application/json',
+ ],
+ 'updateEndpointBxml' => [
+ 'application/xml',
+ ],
+ ];
+
+ /**
+ * @param ClientInterface|null $client
+ * @param Configuration|null $config
+ * @param HeaderSelector|null $selector
+ * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec
+ */
+ public function __construct(
+ ?ClientInterface $client = null,
+ ?Configuration $config = null,
+ ?HeaderSelector $selector = null,
+ int $hostIndex = 0
+ ) {
+ $this->client = $client ?: new Client();
+ $this->config = $config ?: Configuration::getDefaultConfiguration();
+ $this->headerSelector = $selector ?: new HeaderSelector();
+ $this->hostIndex = $hostIndex;
+ }
+
+ /**
+ * Set the host index
+ *
+ * @param int $hostIndex Host index (required)
+ */
+ public function setHostIndex(int $hostIndex): void
+ {
+ $this->hostIndex = $hostIndex;
+ }
+
+ /**
+ * Get the host index
+ *
+ * @return int Host index
+ */
+ public function getHostIndex(): int
+ {
+ return $this->hostIndex;
+ }
+
+ /**
+ * @return Configuration
+ */
+ public function getConfig(): Configuration
+ {
+ return $this->config;
+ }
+
+ /**
+ * Operation createEndpoint
+ *
+ * Create Endpoint
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://api.bandwidth.com/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param \Bandwidth\Model\CreateWebRtcConnectionRequest $body body (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createEndpoint'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return \Bandwidth\Model\CreateEndpointResponse|\Bandwidth\Model\BrtcErrorResponse
+ */
+ public function createEndpoint(
+ string $account_id,
+ \Bandwidth\Model\CreateWebRtcConnectionRequest $body,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['createEndpoint'][0]
+ ): \Bandwidth\Model\CreateEndpointResponse|\Bandwidth\Model\BrtcErrorResponse
+ {
+ list($response) = $this->createEndpointWithHttpInfo($account_id, $body, $hostIndex, $variables, $contentType);
+ return $response;
+ }
+
+ /**
+ * Operation createEndpointWithHttpInfo
+ *
+ * Create Endpoint
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://api.bandwidth.com/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param \Bandwidth\Model\CreateWebRtcConnectionRequest $body (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createEndpoint'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return array{0: \Bandwidth\Model\CreateEndpointResponse|\Bandwidth\Model\BrtcErrorResponse, 1: int, 2: array} [response data, HTTP status code, HTTP response headers]
+ */
+ public function createEndpointWithHttpInfo(
+ string $account_id,
+ \Bandwidth\Model\CreateWebRtcConnectionRequest $body,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['createEndpoint'][0]
+ ): array
+ {
+ $request = $this->createEndpointRequest($account_id, $body, $hostIndex, $variables, $contentType);
+
+ try {
+ $options = $this->createHttpClientOption();
+ try {
+ $response = $this->client->send($request, $options);
+ } catch (RequestException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
+ $e->getResponse() ? (string) $e->getResponse()->getBody() : null
+ );
+ } catch (ConnectException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ null,
+ null
+ );
+ }
+
+ $statusCode = $response->getStatusCode();
+
+ switch($statusCode) {
+ case 201:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\CreateEndpointResponse',
+ $request,
+ $response,
+ );
+ case 400:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\BrtcErrorResponse',
+ $request,
+ $response,
+ );
+ case 401:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\BrtcErrorResponse',
+ $request,
+ $response,
+ );
+ case 403:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\BrtcErrorResponse',
+ $request,
+ $response,
+ );
+ case 404:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\BrtcErrorResponse',
+ $request,
+ $response,
+ );
+ case 405:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\BrtcErrorResponse',
+ $request,
+ $response,
+ );
+ case 415:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\BrtcErrorResponse',
+ $request,
+ $response,
+ );
+ case 429:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\BrtcErrorResponse',
+ $request,
+ $response,
+ );
+ case 500:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\BrtcErrorResponse',
+ $request,
+ $response,
+ );
+ }
+
+ if ($statusCode < 200 || $statusCode > 299) {
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ (string) $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\CreateEndpointResponse',
+ $request,
+ $response,
+ );
+ } catch (ApiException $e) {
+ switch ($e->getCode()) {
+ case 201:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\CreateEndpointResponse',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 400:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\BrtcErrorResponse',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 401:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\BrtcErrorResponse',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 403:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\BrtcErrorResponse',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 404:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\BrtcErrorResponse',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 405:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\BrtcErrorResponse',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 415:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\BrtcErrorResponse',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 429:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\BrtcErrorResponse',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 500:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\BrtcErrorResponse',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ }
+
+ throw $e;
+ }
+ }
+
+ /**
+ * Operation createEndpointAsync
+ *
+ * Create Endpoint
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://api.bandwidth.com/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param \Bandwidth\Model\CreateWebRtcConnectionRequest $body (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createEndpoint'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function createEndpointAsync(
+ string $account_id,
+ \Bandwidth\Model\CreateWebRtcConnectionRequest $body,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['createEndpoint'][0]
+ ): PromiseInterface
+ {
+ return $this->createEndpointAsyncWithHttpInfo($account_id, $body, $hostIndex, $variables, $contentType)
+ ->then(
+ function ($response) {
+ return $response[0];
+ }
+ );
+ }
+
+ /**
+ * Operation createEndpointAsyncWithHttpInfo
+ *
+ * Create Endpoint
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://api.bandwidth.com/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param \Bandwidth\Model\CreateWebRtcConnectionRequest $body (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createEndpoint'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function createEndpointAsyncWithHttpInfo(
+ string $account_id,
+ \Bandwidth\Model\CreateWebRtcConnectionRequest $body,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['createEndpoint'][0]
+ ): PromiseInterface
+ {
+ $returnType = '\Bandwidth\Model\CreateEndpointResponse';
+ $request = $this->createEndpointRequest($account_id, $body, $hostIndex, $variables, $contentType);
+
+ return $this->client
+ ->sendAsync($request, $this->createHttpClientOption())
+ ->then(
+ function ($response) use ($returnType) {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ },
+ function ($exception) {
+ $response = $exception->getResponse();
+ $statusCode = $response->getStatusCode();
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ $exception->getRequest()->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+ );
+ }
+
+ /**
+ * Create request for operation 'createEndpoint'
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://api.bandwidth.com/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param \Bandwidth\Model\CreateWebRtcConnectionRequest $body (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createEndpoint'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return \GuzzleHttp\Psr7\Request
+ */
+ public function createEndpointRequest(
+ string $account_id,
+ \Bandwidth\Model\CreateWebRtcConnectionRequest $body,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['createEndpoint'][0]
+ ): Request
+ {
+ // verify the required parameter 'account_id' is set
+ if ($account_id === null || (is_array($account_id) && count($account_id) === 0)) {
+ throw new InvalidArgumentException(
+ 'Missing the required parameter $account_id when calling createEndpoint'
+ );
+ }
+ // verify the required parameter 'body' is set
+ if ($body === null || (is_array($body) && count($body) === 0)) {
+ throw new InvalidArgumentException(
+ 'Missing the required parameter $body when calling createEndpoint'
+ );
+ }
+
+ $resourcePath = '/accounts/{accountId}/endpoints';
+ $formParams = [];
+ $queryParams = [];
+ $headerParams = [];
+ $httpBody = '';
+ $multipart = false;
+
+
+
+ // path params
+ if ($account_id !== null) {
+ $resourcePath = str_replace(
+ '{accountId}',
+ ObjectSerializer::toPathValue($account_id),
+ $resourcePath
+ );
+ }
+
+
+ $headers = $this->headerSelector->selectHeaders(
+ ['application/json', ],
+ $contentType,
+ $multipart
+ );
+
+ // for model (json/xml)
+ if (isset($body)) {
+ if (stripos($headers['Content-Type'], 'application/json') !== false) {
+ # if Content-Type contains "application/json", json_encode the body
+ $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($body));
+ } else {
+ $httpBody = $body;
+ }
+ } elseif (count($formParams) > 0) {
+ if ($multipart) {
+ $multipartContents = [];
+ foreach ($formParams as $formParamName => $formParamValue) {
+ $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
+ foreach ($formParamValueItems as $formParamValueItem) {
+ $multipartContents[] = [
+ 'name' => $formParamName,
+ 'contents' => $formParamValueItem
+ ];
+ }
+ }
+ // for HTTP post (form)
+ $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents);
+
+ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
+ # if Content-Type contains "application/json", json_encode the form parameters
+ $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams);
+ } else {
+ // for HTTP post (form)
+ $httpBody = ObjectSerializer::buildQuery($formParams);
+ }
+ }
+
+ // this endpoint requires HTTP basic authentication
+ if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) {
+ $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword());
+ }
+
+ // this endpoint requires OAuth (access token)
+ if (!empty($this->config->getAccessToken())) {
+ $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken();
+ }
+
+ $defaultHeaders = [];
+ if ($this->config->getUserAgent()) {
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
+ }
+
+ $headers = array_merge(
+ $defaultHeaders,
+ $headerParams,
+ $headers
+ );
+
+ if ($this->config->getIgnoreOperationHosts()) {
+ $operationHost = $this->config->getHost();
+ } else {
+ # Preserve the original behavior of server indexing.
+ if ($hostIndex === null) {
+ $hostIndex = $this->hostIndex;
+ }
+
+ $hostSettings = $this->getHostSettingsForcreateEndpoint();
+
+ if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) {
+ throw new InvalidArgumentException("Invalid index {$hostIndex} when selecting the host. Must be less than ".count($hostSettings));
+ }
+ $operationHost = Configuration::getHostString($hostSettings, $hostIndex, $variables);
+ }
+ $query = ObjectSerializer::buildQuery($queryParams);
+ return new Request(
+ 'POST',
+ $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
+ $headers,
+ $httpBody
+ );
+ }
+
+ /**
+ * Returns an array of host settings for Operation createEndpoint
+ *
+ * @return array an array of host settings
+ */
+ protected function getHostSettingsForcreateEndpoint(): array
+ {
+ return [
+ [
+ "url" => "https://api.bandwidth.com/v2",
+ "description" => "Production",
+ ]
+ ];
+ }
+
+ /**
+ * Operation deleteEndpoint
+ *
+ * Delete Endpoint
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://api.bandwidth.com/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $endpoint_id BRTC Endpoint ID. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteEndpoint'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return \Bandwidth\Model\BrtcErrorResponse|null
+ */
+ public function deleteEndpoint(
+ string $account_id,
+ string $endpoint_id,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['deleteEndpoint'][0]
+ ): ?\Bandwidth\Model\BrtcErrorResponse
+ {
+ list($response) = $this->deleteEndpointWithHttpInfo($account_id, $endpoint_id, $hostIndex, $variables, $contentType);
+ return $response;
+ }
+
+ /**
+ * Operation deleteEndpointWithHttpInfo
+ *
+ * Delete Endpoint
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://api.bandwidth.com/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $endpoint_id BRTC Endpoint ID. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteEndpoint'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return array{0: null, 1: int, 2: array} [response data, HTTP status code, HTTP response headers]
+ */
+ public function deleteEndpointWithHttpInfo(
+ string $account_id,
+ string $endpoint_id,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['deleteEndpoint'][0]
+ ): array
+ {
+ $request = $this->deleteEndpointRequest($account_id, $endpoint_id, $hostIndex, $variables, $contentType);
+
+ try {
+ $options = $this->createHttpClientOption();
+ try {
+ $response = $this->client->send($request, $options);
+ } catch (RequestException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
+ $e->getResponse() ? (string) $e->getResponse()->getBody() : null
+ );
+ } catch (ConnectException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ null,
+ null
+ );
+ }
+
+ $statusCode = $response->getStatusCode();
+
+
+ return [null, $statusCode, $response->getHeaders()];
+ } catch (ApiException $e) {
+ switch ($e->getCode()) {
+ case 400:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\BrtcErrorResponse',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 401:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\BrtcErrorResponse',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 403:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\BrtcErrorResponse',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 404:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\BrtcErrorResponse',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 405:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\BrtcErrorResponse',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 415:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\BrtcErrorResponse',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 429:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\BrtcErrorResponse',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 500:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\BrtcErrorResponse',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ }
+
+ throw $e;
+ }
+ }
+
+ /**
+ * Operation deleteEndpointAsync
+ *
+ * Delete Endpoint
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://api.bandwidth.com/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $endpoint_id BRTC Endpoint ID. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteEndpoint'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function deleteEndpointAsync(
+ string $account_id,
+ string $endpoint_id,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['deleteEndpoint'][0]
+ ): PromiseInterface
+ {
+ return $this->deleteEndpointAsyncWithHttpInfo($account_id, $endpoint_id, $hostIndex, $variables, $contentType)
+ ->then(
+ function ($response) {
+ return $response[0];
+ }
+ );
+ }
+
+ /**
+ * Operation deleteEndpointAsyncWithHttpInfo
+ *
+ * Delete Endpoint
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://api.bandwidth.com/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $endpoint_id BRTC Endpoint ID. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteEndpoint'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function deleteEndpointAsyncWithHttpInfo(
+ string $account_id,
+ string $endpoint_id,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['deleteEndpoint'][0]
+ ): PromiseInterface
+ {
+ $returnType = '';
+ $request = $this->deleteEndpointRequest($account_id, $endpoint_id, $hostIndex, $variables, $contentType);
+
+ return $this->client
+ ->sendAsync($request, $this->createHttpClientOption())
+ ->then(
+ function ($response) use ($returnType) {
+ return [null, $response->getStatusCode(), $response->getHeaders()];
+ },
+ function ($exception) {
+ $response = $exception->getResponse();
+ $statusCode = $response->getStatusCode();
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ $exception->getRequest()->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+ );
+ }
+
+ /**
+ * Create request for operation 'deleteEndpoint'
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://api.bandwidth.com/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $endpoint_id BRTC Endpoint ID. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteEndpoint'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return \GuzzleHttp\Psr7\Request
+ */
+ public function deleteEndpointRequest(
+ string $account_id,
+ string $endpoint_id,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['deleteEndpoint'][0]
+ ): Request
+ {
+ // verify the required parameter 'account_id' is set
+ if ($account_id === null || (is_array($account_id) && count($account_id) === 0)) {
+ throw new InvalidArgumentException(
+ 'Missing the required parameter $account_id when calling deleteEndpoint'
+ );
+ }
+ // verify the required parameter 'endpoint_id' is set
+ if ($endpoint_id === null || (is_array($endpoint_id) && count($endpoint_id) === 0)) {
+ throw new InvalidArgumentException(
+ 'Missing the required parameter $endpoint_id when calling deleteEndpoint'
+ );
+ }
+
+ $resourcePath = '/accounts/{accountId}/endpoints/{endpointId}';
+ $queryParams = [];
+ $headerParams = [];
+ $httpBody = '';
+ $multipart = false;
+
+
+
+ // path params
+ if ($account_id !== null) {
+ $resourcePath = str_replace(
+ '{accountId}',
+ ObjectSerializer::toPathValue($account_id),
+ $resourcePath
+ );
+ }
+ // path params
+ if ($endpoint_id !== null) {
+ $resourcePath = str_replace(
+ '{endpointId}',
+ ObjectSerializer::toPathValue($endpoint_id),
+ $resourcePath
+ );
+ }
+
+
+ $headers = $this->headerSelector->selectHeaders(
+ ['application/json', ],
+ $contentType,
+ $multipart
+ );
+
+
+ // this endpoint requires HTTP basic authentication
+ if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) {
+ $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword());
+ }
+
+ // this endpoint requires OAuth (access token)
+ if (!empty($this->config->getAccessToken())) {
+ $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken();
+ }
+
+ $defaultHeaders = [];
+ if ($this->config->getUserAgent()) {
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
+ }
+
+ $headers = array_merge(
+ $defaultHeaders,
+ $headerParams,
+ $headers
+ );
+
+ if ($this->config->getIgnoreOperationHosts()) {
+ $operationHost = $this->config->getHost();
+ } else {
+ # Preserve the original behavior of server indexing.
+ if ($hostIndex === null) {
+ $hostIndex = $this->hostIndex;
+ }
+
+ $hostSettings = $this->getHostSettingsFordeleteEndpoint();
+
+ if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) {
+ throw new InvalidArgumentException("Invalid index {$hostIndex} when selecting the host. Must be less than ".count($hostSettings));
+ }
+ $operationHost = Configuration::getHostString($hostSettings, $hostIndex, $variables);
+ }
+ $query = ObjectSerializer::buildQuery($queryParams);
+ return new Request(
+ 'DELETE',
+ $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
+ $headers,
+ $httpBody
+ );
+ }
+
+ /**
+ * Returns an array of host settings for Operation deleteEndpoint
+ *
+ * @return array an array of host settings
+ */
+ protected function getHostSettingsFordeleteEndpoint(): array
+ {
+ return [
+ [
+ "url" => "https://api.bandwidth.com/v2",
+ "description" => "Production",
+ ]
+ ];
+ }
+
+ /**
+ * Operation getEndpoint
+ *
+ * Get Endpoint
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://api.bandwidth.com/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $endpoint_id BRTC Endpoint ID. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEndpoint'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return \Bandwidth\Model\EndpointResponse|\Bandwidth\Model\BrtcErrorResponse
+ */
+ public function getEndpoint(
+ string $account_id,
+ string $endpoint_id,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['getEndpoint'][0]
+ ): \Bandwidth\Model\EndpointResponse|\Bandwidth\Model\BrtcErrorResponse
+ {
+ list($response) = $this->getEndpointWithHttpInfo($account_id, $endpoint_id, $hostIndex, $variables, $contentType);
+ return $response;
+ }
+
+ /**
+ * Operation getEndpointWithHttpInfo
+ *
+ * Get Endpoint
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://api.bandwidth.com/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $endpoint_id BRTC Endpoint ID. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEndpoint'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return array{0: \Bandwidth\Model\EndpointResponse|\Bandwidth\Model\BrtcErrorResponse, 1: int, 2: array} [response data, HTTP status code, HTTP response headers]
+ */
+ public function getEndpointWithHttpInfo(
+ string $account_id,
+ string $endpoint_id,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['getEndpoint'][0]
+ ): array
+ {
+ $request = $this->getEndpointRequest($account_id, $endpoint_id, $hostIndex, $variables, $contentType);
+
+ try {
+ $options = $this->createHttpClientOption();
+ try {
+ $response = $this->client->send($request, $options);
+ } catch (RequestException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
+ $e->getResponse() ? (string) $e->getResponse()->getBody() : null
+ );
+ } catch (ConnectException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ null,
+ null
+ );
+ }
+
+ $statusCode = $response->getStatusCode();
+
+ switch($statusCode) {
+ case 200:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\EndpointResponse',
+ $request,
+ $response,
+ );
+ case 400:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\BrtcErrorResponse',
+ $request,
+ $response,
+ );
+ case 401:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\BrtcErrorResponse',
+ $request,
+ $response,
+ );
+ case 403:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\BrtcErrorResponse',
+ $request,
+ $response,
+ );
+ case 404:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\BrtcErrorResponse',
+ $request,
+ $response,
+ );
+ case 405:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\BrtcErrorResponse',
+ $request,
+ $response,
+ );
+ case 415:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\BrtcErrorResponse',
+ $request,
+ $response,
+ );
+ case 429:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\BrtcErrorResponse',
+ $request,
+ $response,
+ );
+ case 500:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\BrtcErrorResponse',
+ $request,
+ $response,
+ );
+ }
+
+ if ($statusCode < 200 || $statusCode > 299) {
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ (string) $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\EndpointResponse',
+ $request,
+ $response,
+ );
+ } catch (ApiException $e) {
+ switch ($e->getCode()) {
+ case 200:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\EndpointResponse',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 400:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\BrtcErrorResponse',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 401:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\BrtcErrorResponse',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 403:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\BrtcErrorResponse',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 404:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\BrtcErrorResponse',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 405:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\BrtcErrorResponse',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 415:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\BrtcErrorResponse',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 429:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\BrtcErrorResponse',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 500:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\BrtcErrorResponse',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ }
+
+ throw $e;
+ }
+ }
+
+ /**
+ * Operation getEndpointAsync
+ *
+ * Get Endpoint
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://api.bandwidth.com/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $endpoint_id BRTC Endpoint ID. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEndpoint'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function getEndpointAsync(
+ string $account_id,
+ string $endpoint_id,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['getEndpoint'][0]
+ ): PromiseInterface
+ {
+ return $this->getEndpointAsyncWithHttpInfo($account_id, $endpoint_id, $hostIndex, $variables, $contentType)
+ ->then(
+ function ($response) {
+ return $response[0];
+ }
+ );
+ }
+
+ /**
+ * Operation getEndpointAsyncWithHttpInfo
+ *
+ * Get Endpoint
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://api.bandwidth.com/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $endpoint_id BRTC Endpoint ID. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEndpoint'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function getEndpointAsyncWithHttpInfo(
+ string $account_id,
+ string $endpoint_id,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['getEndpoint'][0]
+ ): PromiseInterface
+ {
+ $returnType = '\Bandwidth\Model\EndpointResponse';
+ $request = $this->getEndpointRequest($account_id, $endpoint_id, $hostIndex, $variables, $contentType);
+
+ return $this->client
+ ->sendAsync($request, $this->createHttpClientOption())
+ ->then(
+ function ($response) use ($returnType) {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ },
+ function ($exception) {
+ $response = $exception->getResponse();
+ $statusCode = $response->getStatusCode();
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ $exception->getRequest()->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+ );
+ }
+
+ /**
+ * Create request for operation 'getEndpoint'
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://api.bandwidth.com/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $endpoint_id BRTC Endpoint ID. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEndpoint'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return \GuzzleHttp\Psr7\Request
+ */
+ public function getEndpointRequest(
+ string $account_id,
+ string $endpoint_id,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['getEndpoint'][0]
+ ): Request
+ {
+ // verify the required parameter 'account_id' is set
+ if ($account_id === null || (is_array($account_id) && count($account_id) === 0)) {
+ throw new InvalidArgumentException(
+ 'Missing the required parameter $account_id when calling getEndpoint'
+ );
+ }
+ // verify the required parameter 'endpoint_id' is set
+ if ($endpoint_id === null || (is_array($endpoint_id) && count($endpoint_id) === 0)) {
+ throw new InvalidArgumentException(
+ 'Missing the required parameter $endpoint_id when calling getEndpoint'
+ );
+ }
+
+ $resourcePath = '/accounts/{accountId}/endpoints/{endpointId}';
+ $queryParams = [];
+ $headerParams = [];
+ $httpBody = '';
+ $multipart = false;
+
+
+
+ // path params
+ if ($account_id !== null) {
+ $resourcePath = str_replace(
+ '{accountId}',
+ ObjectSerializer::toPathValue($account_id),
+ $resourcePath
+ );
+ }
+ // path params
+ if ($endpoint_id !== null) {
+ $resourcePath = str_replace(
+ '{endpointId}',
+ ObjectSerializer::toPathValue($endpoint_id),
+ $resourcePath
+ );
+ }
+
+
+ $headers = $this->headerSelector->selectHeaders(
+ ['application/json', ],
+ $contentType,
+ $multipart
+ );
+
+
+ // this endpoint requires HTTP basic authentication
+ if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) {
+ $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword());
+ }
+
+ // this endpoint requires OAuth (access token)
+ if (!empty($this->config->getAccessToken())) {
+ $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken();
+ }
+
+ $defaultHeaders = [];
+ if ($this->config->getUserAgent()) {
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
+ }
+
+ $headers = array_merge(
+ $defaultHeaders,
+ $headerParams,
+ $headers
+ );
+
+ if ($this->config->getIgnoreOperationHosts()) {
+ $operationHost = $this->config->getHost();
+ } else {
+ # Preserve the original behavior of server indexing.
+ if ($hostIndex === null) {
+ $hostIndex = $this->hostIndex;
+ }
+
+ $hostSettings = $this->getHostSettingsForgetEndpoint();
+
+ if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) {
+ throw new InvalidArgumentException("Invalid index {$hostIndex} when selecting the host. Must be less than ".count($hostSettings));
+ }
+ $operationHost = Configuration::getHostString($hostSettings, $hostIndex, $variables);
+ }
+ $query = ObjectSerializer::buildQuery($queryParams);
+ return new Request(
+ 'GET',
+ $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
+ $headers,
+ $httpBody
+ );
+ }
+
+ /**
+ * Returns an array of host settings for Operation getEndpoint
+ *
+ * @return array an array of host settings
+ */
+ protected function getHostSettingsForgetEndpoint(): array
+ {
+ return [
+ [
+ "url" => "https://api.bandwidth.com/v2",
+ "description" => "Production",
+ ]
+ ];
+ }
+
+ /**
+ * Operation listEndpoints
+ *
+ * List Endpoints
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://api.bandwidth.com/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param \Bandwidth\Model\EndpointTypeEnum|null $type The type of endpoint. (optional)
+ * @param \Bandwidth\Model\EndpointStatusEnum|null $status The status of the endpoint. (optional)
+ * @param string|null $after_cursor The cursor to use for pagination. This is the value of the `next` link in the previous response. (optional)
+ * @param int|null $limit The maximum number of endpoints to return in the response. (optional, default to 100)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listEndpoints'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return \Bandwidth\Model\ListEndpointsResponse|\Bandwidth\Model\BrtcErrorResponse
+ */
+ public function listEndpoints(
+ string $account_id,
+ ?\Bandwidth\Model\EndpointTypeEnum $type = null,
+ ?\Bandwidth\Model\EndpointStatusEnum $status = null,
+ ?string $after_cursor = null,
+ ?int $limit = 100,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['listEndpoints'][0]
+ ): \Bandwidth\Model\ListEndpointsResponse|\Bandwidth\Model\BrtcErrorResponse
+ {
+ list($response) = $this->listEndpointsWithHttpInfo($account_id, $type, $status, $after_cursor, $limit, $hostIndex, $variables, $contentType);
+ return $response;
+ }
+
+ /**
+ * Operation listEndpointsWithHttpInfo
+ *
+ * List Endpoints
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://api.bandwidth.com/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param \Bandwidth\Model\EndpointTypeEnum|null $type The type of endpoint. (optional)
+ * @param \Bandwidth\Model\EndpointStatusEnum|null $status The status of the endpoint. (optional)
+ * @param string|null $after_cursor The cursor to use for pagination. This is the value of the `next` link in the previous response. (optional)
+ * @param int|null $limit The maximum number of endpoints to return in the response. (optional, default to 100)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listEndpoints'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return array{0: \Bandwidth\Model\ListEndpointsResponse|\Bandwidth\Model\BrtcErrorResponse, 1: int, 2: array} [response data, HTTP status code, HTTP response headers]
+ */
+ public function listEndpointsWithHttpInfo(
+ string $account_id,
+ ?\Bandwidth\Model\EndpointTypeEnum $type = null,
+ ?\Bandwidth\Model\EndpointStatusEnum $status = null,
+ ?string $after_cursor = null,
+ ?int $limit = 100,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['listEndpoints'][0]
+ ): array
+ {
+ $request = $this->listEndpointsRequest($account_id, $type, $status, $after_cursor, $limit, $hostIndex, $variables, $contentType);
+
+ try {
+ $options = $this->createHttpClientOption();
+ try {
+ $response = $this->client->send($request, $options);
+ } catch (RequestException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
+ $e->getResponse() ? (string) $e->getResponse()->getBody() : null
+ );
+ } catch (ConnectException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ null,
+ null
+ );
+ }
+
+ $statusCode = $response->getStatusCode();
+
+ switch($statusCode) {
+ case 200:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\ListEndpointsResponse',
+ $request,
+ $response,
+ );
+ case 400:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\BrtcErrorResponse',
+ $request,
+ $response,
+ );
+ case 401:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\BrtcErrorResponse',
+ $request,
+ $response,
+ );
+ case 403:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\BrtcErrorResponse',
+ $request,
+ $response,
+ );
+ case 404:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\BrtcErrorResponse',
+ $request,
+ $response,
+ );
+ case 405:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\BrtcErrorResponse',
+ $request,
+ $response,
+ );
+ case 415:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\BrtcErrorResponse',
+ $request,
+ $response,
+ );
+ case 429:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\BrtcErrorResponse',
+ $request,
+ $response,
+ );
+ case 500:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\BrtcErrorResponse',
+ $request,
+ $response,
+ );
+ }
+
+ if ($statusCode < 200 || $statusCode > 299) {
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ (string) $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\ListEndpointsResponse',
+ $request,
+ $response,
+ );
+ } catch (ApiException $e) {
+ switch ($e->getCode()) {
+ case 200:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\ListEndpointsResponse',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 400:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\BrtcErrorResponse',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 401:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\BrtcErrorResponse',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 403:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\BrtcErrorResponse',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 404:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\BrtcErrorResponse',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 405:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\BrtcErrorResponse',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 415:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\BrtcErrorResponse',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 429:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\BrtcErrorResponse',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 500:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\BrtcErrorResponse',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ }
+
+ throw $e;
+ }
+ }
+
+ /**
+ * Operation listEndpointsAsync
+ *
+ * List Endpoints
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://api.bandwidth.com/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param \Bandwidth\Model\EndpointTypeEnum|null $type The type of endpoint. (optional)
+ * @param \Bandwidth\Model\EndpointStatusEnum|null $status The status of the endpoint. (optional)
+ * @param string|null $after_cursor The cursor to use for pagination. This is the value of the `next` link in the previous response. (optional)
+ * @param int|null $limit The maximum number of endpoints to return in the response. (optional, default to 100)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listEndpoints'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function listEndpointsAsync(
+ string $account_id,
+ ?\Bandwidth\Model\EndpointTypeEnum $type = null,
+ ?\Bandwidth\Model\EndpointStatusEnum $status = null,
+ ?string $after_cursor = null,
+ ?int $limit = 100,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['listEndpoints'][0]
+ ): PromiseInterface
+ {
+ return $this->listEndpointsAsyncWithHttpInfo($account_id, $type, $status, $after_cursor, $limit, $hostIndex, $variables, $contentType)
+ ->then(
+ function ($response) {
+ return $response[0];
+ }
+ );
+ }
+
+ /**
+ * Operation listEndpointsAsyncWithHttpInfo
+ *
+ * List Endpoints
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://api.bandwidth.com/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param \Bandwidth\Model\EndpointTypeEnum|null $type The type of endpoint. (optional)
+ * @param \Bandwidth\Model\EndpointStatusEnum|null $status The status of the endpoint. (optional)
+ * @param string|null $after_cursor The cursor to use for pagination. This is the value of the `next` link in the previous response. (optional)
+ * @param int|null $limit The maximum number of endpoints to return in the response. (optional, default to 100)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listEndpoints'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function listEndpointsAsyncWithHttpInfo(
+ string $account_id,
+ ?\Bandwidth\Model\EndpointTypeEnum $type = null,
+ ?\Bandwidth\Model\EndpointStatusEnum $status = null,
+ ?string $after_cursor = null,
+ ?int $limit = 100,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['listEndpoints'][0]
+ ): PromiseInterface
+ {
+ $returnType = '\Bandwidth\Model\ListEndpointsResponse';
+ $request = $this->listEndpointsRequest($account_id, $type, $status, $after_cursor, $limit, $hostIndex, $variables, $contentType);
+
+ return $this->client
+ ->sendAsync($request, $this->createHttpClientOption())
+ ->then(
+ function ($response) use ($returnType) {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ },
+ function ($exception) {
+ $response = $exception->getResponse();
+ $statusCode = $response->getStatusCode();
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ $exception->getRequest()->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+ );
+ }
+
+ /**
+ * Create request for operation 'listEndpoints'
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://api.bandwidth.com/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param \Bandwidth\Model\EndpointTypeEnum|null $type The type of endpoint. (optional)
+ * @param \Bandwidth\Model\EndpointStatusEnum|null $status The status of the endpoint. (optional)
+ * @param string|null $after_cursor The cursor to use for pagination. This is the value of the `next` link in the previous response. (optional)
+ * @param int|null $limit The maximum number of endpoints to return in the response. (optional, default to 100)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listEndpoints'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return \GuzzleHttp\Psr7\Request
+ */
+ public function listEndpointsRequest(
+ string $account_id,
+ ?\Bandwidth\Model\EndpointTypeEnum $type = null,
+ ?\Bandwidth\Model\EndpointStatusEnum $status = null,
+ ?string $after_cursor = null,
+ ?int $limit = 100,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['listEndpoints'][0]
+ ): Request
+ {
+ // verify the required parameter 'account_id' is set
+ if ($account_id === null || (is_array($account_id) && count($account_id) === 0)) {
+ throw new InvalidArgumentException(
+ 'Missing the required parameter $account_id when calling listEndpoints'
+ );
+ }
+ if ($limit !== null && $limit > 1000) {
+ throw new InvalidArgumentException('invalid value for "$limit" when calling EndpointsApi.listEndpoints, must be smaller than or equal to 1000.');
+ }
+ if ($limit !== null && $limit < 1) {
+ throw new InvalidArgumentException('invalid value for "$limit" when calling EndpointsApi.listEndpoints, must be bigger than or equal to 1.');
+ }
+
+ $resourcePath = '/accounts/{accountId}/endpoints';
+ $queryParams = [];
+ $headerParams = [];
+ $httpBody = '';
+ $multipart = false;
+
+ // query params
+ $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+ $type?->value,
+ 'type', // param base name
+ 'EndpointTypeEnum', // openApiType
+ 'form', // style
+ true, // explode
+ false // required
+ ) ?? []);
+ // query params
+ $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+ $status?->value,
+ 'status', // param base name
+ 'EndpointStatusEnum', // openApiType
+ 'form', // style
+ true, // explode
+ false // required
+ ) ?? []);
+ // query params
+ $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+ $after_cursor,
+ 'afterCursor', // param base name
+ 'string', // openApiType
+ 'form', // style
+ true, // explode
+ false // required
+ ) ?? []);
+ // query params
+ $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+ $limit,
+ 'limit', // param base name
+ 'integer', // openApiType
+ 'form', // style
+ true, // explode
+ false // required
+ ) ?? []);
+
+
+ // path params
+ if ($account_id !== null) {
+ $resourcePath = str_replace(
+ '{accountId}',
+ ObjectSerializer::toPathValue($account_id),
+ $resourcePath
+ );
+ }
+
+
+ $headers = $this->headerSelector->selectHeaders(
+ ['application/json', ],
+ $contentType,
+ $multipart
+ );
+
+
+ // this endpoint requires HTTP basic authentication
+ if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) {
+ $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword());
+ }
+
+ // this endpoint requires OAuth (access token)
+ if (!empty($this->config->getAccessToken())) {
+ $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken();
+ }
+
+ $defaultHeaders = [];
+ if ($this->config->getUserAgent()) {
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
+ }
+
+ $headers = array_merge(
+ $defaultHeaders,
+ $headerParams,
+ $headers
+ );
+
+ if ($this->config->getIgnoreOperationHosts()) {
+ $operationHost = $this->config->getHost();
+ } else {
+ # Preserve the original behavior of server indexing.
+ if ($hostIndex === null) {
+ $hostIndex = $this->hostIndex;
+ }
+
+ $hostSettings = $this->getHostSettingsForlistEndpoints();
+
+ if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) {
+ throw new InvalidArgumentException("Invalid index {$hostIndex} when selecting the host. Must be less than ".count($hostSettings));
+ }
+ $operationHost = Configuration::getHostString($hostSettings, $hostIndex, $variables);
+ }
+ $query = ObjectSerializer::buildQuery($queryParams);
+ return new Request(
+ 'GET',
+ $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
+ $headers,
+ $httpBody
+ );
+ }
+
+ /**
+ * Returns an array of host settings for Operation listEndpoints
+ *
+ * @return array an array of host settings
+ */
+ protected function getHostSettingsForlistEndpoints(): array
+ {
+ return [
+ [
+ "url" => "https://api.bandwidth.com/v2",
+ "description" => "Production",
+ ]
+ ];
+ }
+
+ /**
+ * Operation updateEndpointBxml
+ *
+ * Update Endpoint BXML
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://api.bandwidth.com/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $endpoint_id BRTC Endpoint ID. (required)
+ * @param string $body body (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateEndpointBxml'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return \Bandwidth\Model\BrtcErrorResponse|null
+ */
+ public function updateEndpointBxml(
+ string $account_id,
+ string $endpoint_id,
+ string $body,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['updateEndpointBxml'][0]
+ ): ?\Bandwidth\Model\BrtcErrorResponse
+ {
+ list($response) = $this->updateEndpointBxmlWithHttpInfo($account_id, $endpoint_id, $body, $hostIndex, $variables, $contentType);
+ return $response;
+ }
+
+ /**
+ * Operation updateEndpointBxmlWithHttpInfo
+ *
+ * Update Endpoint BXML
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://api.bandwidth.com/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $endpoint_id BRTC Endpoint ID. (required)
+ * @param string $body (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateEndpointBxml'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return array{0: null, 1: int, 2: array} [response data, HTTP status code, HTTP response headers]
+ */
+ public function updateEndpointBxmlWithHttpInfo(
+ string $account_id,
+ string $endpoint_id,
+ string $body,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['updateEndpointBxml'][0]
+ ): array
+ {
+ $request = $this->updateEndpointBxmlRequest($account_id, $endpoint_id, $body, $hostIndex, $variables, $contentType);
+
+ try {
+ $options = $this->createHttpClientOption();
+ try {
+ $response = $this->client->send($request, $options);
+ } catch (RequestException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
+ $e->getResponse() ? (string) $e->getResponse()->getBody() : null
+ );
+ } catch (ConnectException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ null,
+ null
+ );
+ }
+
+ $statusCode = $response->getStatusCode();
+
+
+ return [null, $statusCode, $response->getHeaders()];
+ } catch (ApiException $e) {
+ switch ($e->getCode()) {
+ case 400:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\BrtcErrorResponse',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 401:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\BrtcErrorResponse',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 403:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\BrtcErrorResponse',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 404:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\BrtcErrorResponse',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 405:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\BrtcErrorResponse',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 415:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\BrtcErrorResponse',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 429:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\BrtcErrorResponse',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 500:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\BrtcErrorResponse',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ }
+
+ throw $e;
+ }
+ }
+
+ /**
+ * Operation updateEndpointBxmlAsync
+ *
+ * Update Endpoint BXML
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://api.bandwidth.com/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $endpoint_id BRTC Endpoint ID. (required)
+ * @param string $body (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateEndpointBxml'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function updateEndpointBxmlAsync(
+ string $account_id,
+ string $endpoint_id,
+ string $body,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['updateEndpointBxml'][0]
+ ): PromiseInterface
+ {
+ return $this->updateEndpointBxmlAsyncWithHttpInfo($account_id, $endpoint_id, $body, $hostIndex, $variables, $contentType)
+ ->then(
+ function ($response) {
+ return $response[0];
+ }
+ );
+ }
+
+ /**
+ * Operation updateEndpointBxmlAsyncWithHttpInfo
+ *
+ * Update Endpoint BXML
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://api.bandwidth.com/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $endpoint_id BRTC Endpoint ID. (required)
+ * @param string $body (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateEndpointBxml'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function updateEndpointBxmlAsyncWithHttpInfo(
+ string $account_id,
+ string $endpoint_id,
+ string $body,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['updateEndpointBxml'][0]
+ ): PromiseInterface
+ {
+ $returnType = '';
+ $request = $this->updateEndpointBxmlRequest($account_id, $endpoint_id, $body, $hostIndex, $variables, $contentType);
+
+ return $this->client
+ ->sendAsync($request, $this->createHttpClientOption())
+ ->then(
+ function ($response) use ($returnType) {
+ return [null, $response->getStatusCode(), $response->getHeaders()];
+ },
+ function ($exception) {
+ $response = $exception->getResponse();
+ $statusCode = $response->getStatusCode();
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ $exception->getRequest()->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+ );
+ }
+
+ /**
+ * Create request for operation 'updateEndpointBxml'
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://api.bandwidth.com/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $endpoint_id BRTC Endpoint ID. (required)
+ * @param string $body (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateEndpointBxml'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return \GuzzleHttp\Psr7\Request
+ */
+ public function updateEndpointBxmlRequest(
+ string $account_id,
+ string $endpoint_id,
+ string $body,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['updateEndpointBxml'][0]
+ ): Request
+ {
+ // verify the required parameter 'account_id' is set
+ if ($account_id === null || (is_array($account_id) && count($account_id) === 0)) {
+ throw new InvalidArgumentException(
+ 'Missing the required parameter $account_id when calling updateEndpointBxml'
+ );
+ }
+ // verify the required parameter 'endpoint_id' is set
+ if ($endpoint_id === null || (is_array($endpoint_id) && count($endpoint_id) === 0)) {
+ throw new InvalidArgumentException(
+ 'Missing the required parameter $endpoint_id when calling updateEndpointBxml'
+ );
+ }
+ // verify the required parameter 'body' is set
+ if ($body === null || (is_array($body) && count($body) === 0)) {
+ throw new InvalidArgumentException(
+ 'Missing the required parameter $body when calling updateEndpointBxml'
+ );
+ }
+
+ $resourcePath = '/accounts/{accountId}/endpoints/{endpointId}/bxml';
+ $formParams = [];
+ $queryParams = [];
+ $headerParams = [];
+ $httpBody = '';
+ $multipart = false;
+
+
+
+ // path params
+ if ($account_id !== null) {
+ $resourcePath = str_replace(
+ '{accountId}',
+ ObjectSerializer::toPathValue($account_id),
+ $resourcePath
+ );
+ }
+ // path params
+ if ($endpoint_id !== null) {
+ $resourcePath = str_replace(
+ '{endpointId}',
+ ObjectSerializer::toPathValue($endpoint_id),
+ $resourcePath
+ );
+ }
+
+
+ $headers = $this->headerSelector->selectHeaders(
+ ['application/json', ],
+ $contentType,
+ $multipart
+ );
+
+ // for model (json/xml)
+ if (isset($body)) {
+ if (stripos($headers['Content-Type'], 'application/json') !== false) {
+ # if Content-Type contains "application/json", json_encode the body
+ $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($body));
+ } else {
+ $httpBody = $body;
+ }
+ } elseif (count($formParams) > 0) {
+ if ($multipart) {
+ $multipartContents = [];
+ foreach ($formParams as $formParamName => $formParamValue) {
+ $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
+ foreach ($formParamValueItems as $formParamValueItem) {
+ $multipartContents[] = [
+ 'name' => $formParamName,
+ 'contents' => $formParamValueItem
+ ];
+ }
+ }
+ // for HTTP post (form)
+ $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents);
+
+ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
+ # if Content-Type contains "application/json", json_encode the form parameters
+ $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams);
+ } else {
+ // for HTTP post (form)
+ $httpBody = ObjectSerializer::buildQuery($formParams);
+ }
+ }
+
+ // this endpoint requires HTTP basic authentication
+ if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) {
+ $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword());
+ }
+
+ // this endpoint requires OAuth (access token)
+ if (!empty($this->config->getAccessToken())) {
+ $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken();
+ }
+
+ $defaultHeaders = [];
+ if ($this->config->getUserAgent()) {
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
+ }
+
+ $headers = array_merge(
+ $defaultHeaders,
+ $headerParams,
+ $headers
+ );
+
+ if ($this->config->getIgnoreOperationHosts()) {
+ $operationHost = $this->config->getHost();
+ } else {
+ # Preserve the original behavior of server indexing.
+ if ($hostIndex === null) {
+ $hostIndex = $this->hostIndex;
+ }
+
+ $hostSettings = $this->getHostSettingsForupdateEndpointBxml();
+
+ if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) {
+ throw new InvalidArgumentException("Invalid index {$hostIndex} when selecting the host. Must be less than ".count($hostSettings));
+ }
+ $operationHost = Configuration::getHostString($hostSettings, $hostIndex, $variables);
+ }
+ $query = ObjectSerializer::buildQuery($queryParams);
+ return new Request(
+ 'PUT',
+ $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
+ $headers,
+ $httpBody
+ );
+ }
+
+ /**
+ * Returns an array of host settings for Operation updateEndpointBxml
+ *
+ * @return array an array of host settings
+ */
+ protected function getHostSettingsForupdateEndpointBxml(): array
+ {
+ return [
+ [
+ "url" => "https://api.bandwidth.com/v2",
+ "description" => "Production",
+ ]
+ ];
+ }
+
+ /**
+ * Create http client option
+ *
+ * @throws \RuntimeException on file opening failure
+ * @return array of http client options
+ */
+ protected function createHttpClientOption(): array
+ {
+ $options = [];
+ if ($this->config->getDebug()) {
+ $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a');
+ if (!$options[RequestOptions::DEBUG]) {
+ throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile());
+ }
+ }
+
+ return $options;
+ }
+
+ private function handleResponseWithDataType(
+ string $dataType,
+ RequestInterface $request,
+ ResponseInterface $response,
+ ): array {
+ if (in_array($dataType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($dataType !== 'string') {
+ try {
+ $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR);
+ } catch (\JsonException $exception) {
+ throw new ApiException(
+ sprintf(
+ 'Error JSON decoding server response (%s)',
+ $request->getUri()
+ ),
+ $response->getStatusCode(),
+ $response->getHeaders(),
+ $content
+ );
+ }
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $dataType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ }
+
+ private function responseWithinRangeCode(
+ string $rangeCode,
+ int $statusCode,
+ ): bool {
+ $left = (int) ($rangeCode[0].'00');
+ $right = (int) ($rangeCode[0].'99');
+
+ return $statusCode >= $left && $statusCode <= $right;
+ }
+}
diff --git a/src/Api/MFAApi.php b/src/Api/MFAApi.php
new file mode 100644
index 0000000..52947ec
--- /dev/null
+++ b/src/Api/MFAApi.php
@@ -0,0 +1,1510 @@
+ $contentTypes **/
+ public const contentTypes = [
+ 'generateMessagingCode' => [
+ 'application/json',
+ ],
+ 'generateVoiceCode' => [
+ 'application/json',
+ ],
+ 'verifyCode' => [
+ 'application/json',
+ ],
+ ];
+
+ /**
+ * @param ClientInterface|null $client
+ * @param Configuration|null $config
+ * @param HeaderSelector|null $selector
+ * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec
+ */
+ public function __construct(
+ ?ClientInterface $client = null,
+ ?Configuration $config = null,
+ ?HeaderSelector $selector = null,
+ int $hostIndex = 0
+ ) {
+ $this->client = $client ?: new Client();
+ $this->config = $config ?: Configuration::getDefaultConfiguration();
+ $this->headerSelector = $selector ?: new HeaderSelector();
+ $this->hostIndex = $hostIndex;
+ }
+
+ /**
+ * Set the host index
+ *
+ * @param int $hostIndex Host index (required)
+ */
+ public function setHostIndex(int $hostIndex): void
+ {
+ $this->hostIndex = $hostIndex;
+ }
+
+ /**
+ * Get the host index
+ *
+ * @return int Host index
+ */
+ public function getHostIndex(): int
+ {
+ return $this->hostIndex;
+ }
+
+ /**
+ * @return Configuration
+ */
+ public function getConfig(): Configuration
+ {
+ return $this->config;
+ }
+
+ /**
+ * Operation generateMessagingCode
+ *
+ * Messaging Authentication Code
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://mfa.bandwidth.com/api/v1
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param \Bandwidth\Model\CodeRequest $code_request MFA code request body. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['generateMessagingCode'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return \Bandwidth\Model\MessagingCodeResponse|\Bandwidth\Model\MfaRequestError|\Bandwidth\Model\MfaUnauthorizedRequestError|\Bandwidth\Model\MfaForbiddenRequestError
+ */
+ public function generateMessagingCode(
+ string $account_id,
+ \Bandwidth\Model\CodeRequest $code_request,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['generateMessagingCode'][0]
+ ): \Bandwidth\Model\MessagingCodeResponse|\Bandwidth\Model\MfaRequestError|\Bandwidth\Model\MfaUnauthorizedRequestError|\Bandwidth\Model\MfaForbiddenRequestError
+ {
+ list($response) = $this->generateMessagingCodeWithHttpInfo($account_id, $code_request, $hostIndex, $variables, $contentType);
+ return $response;
+ }
+
+ /**
+ * Operation generateMessagingCodeWithHttpInfo
+ *
+ * Messaging Authentication Code
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://mfa.bandwidth.com/api/v1
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param \Bandwidth\Model\CodeRequest $code_request MFA code request body. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['generateMessagingCode'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return array{0: \Bandwidth\Model\MessagingCodeResponse|\Bandwidth\Model\MfaRequestError|\Bandwidth\Model\MfaUnauthorizedRequestError|\Bandwidth\Model\MfaForbiddenRequestError, 1: int, 2: array} [response data, HTTP status code, HTTP response headers]
+ */
+ public function generateMessagingCodeWithHttpInfo(
+ string $account_id,
+ \Bandwidth\Model\CodeRequest $code_request,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['generateMessagingCode'][0]
+ ): array
+ {
+ $request = $this->generateMessagingCodeRequest($account_id, $code_request, $hostIndex, $variables, $contentType);
+
+ try {
+ $options = $this->createHttpClientOption();
+ try {
+ $response = $this->client->send($request, $options);
+ } catch (RequestException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
+ $e->getResponse() ? (string) $e->getResponse()->getBody() : null
+ );
+ } catch (ConnectException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ null,
+ null
+ );
+ }
+
+ $statusCode = $response->getStatusCode();
+
+ switch($statusCode) {
+ case 200:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\MessagingCodeResponse',
+ $request,
+ $response,
+ );
+ case 400:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\MfaRequestError',
+ $request,
+ $response,
+ );
+ case 401:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\MfaUnauthorizedRequestError',
+ $request,
+ $response,
+ );
+ case 403:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\MfaForbiddenRequestError',
+ $request,
+ $response,
+ );
+ case 500:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\MfaRequestError',
+ $request,
+ $response,
+ );
+ }
+
+ if ($statusCode < 200 || $statusCode > 299) {
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ (string) $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\MessagingCodeResponse',
+ $request,
+ $response,
+ );
+ } catch (ApiException $e) {
+ switch ($e->getCode()) {
+ case 200:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\MessagingCodeResponse',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 400:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\MfaRequestError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 401:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\MfaUnauthorizedRequestError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 403:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\MfaForbiddenRequestError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 500:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\MfaRequestError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ }
+
+ throw $e;
+ }
+ }
+
+ /**
+ * Operation generateMessagingCodeAsync
+ *
+ * Messaging Authentication Code
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://mfa.bandwidth.com/api/v1
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param \Bandwidth\Model\CodeRequest $code_request MFA code request body. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['generateMessagingCode'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function generateMessagingCodeAsync(
+ string $account_id,
+ \Bandwidth\Model\CodeRequest $code_request,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['generateMessagingCode'][0]
+ ): PromiseInterface
+ {
+ return $this->generateMessagingCodeAsyncWithHttpInfo($account_id, $code_request, $hostIndex, $variables, $contentType)
+ ->then(
+ function ($response) {
+ return $response[0];
+ }
+ );
+ }
+
+ /**
+ * Operation generateMessagingCodeAsyncWithHttpInfo
+ *
+ * Messaging Authentication Code
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://mfa.bandwidth.com/api/v1
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param \Bandwidth\Model\CodeRequest $code_request MFA code request body. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['generateMessagingCode'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function generateMessagingCodeAsyncWithHttpInfo(
+ string $account_id,
+ \Bandwidth\Model\CodeRequest $code_request,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['generateMessagingCode'][0]
+ ): PromiseInterface
+ {
+ $returnType = '\Bandwidth\Model\MessagingCodeResponse';
+ $request = $this->generateMessagingCodeRequest($account_id, $code_request, $hostIndex, $variables, $contentType);
+
+ return $this->client
+ ->sendAsync($request, $this->createHttpClientOption())
+ ->then(
+ function ($response) use ($returnType) {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ },
+ function ($exception) {
+ $response = $exception->getResponse();
+ $statusCode = $response->getStatusCode();
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ $exception->getRequest()->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+ );
+ }
+
+ /**
+ * Create request for operation 'generateMessagingCode'
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://mfa.bandwidth.com/api/v1
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param \Bandwidth\Model\CodeRequest $code_request MFA code request body. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['generateMessagingCode'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return \GuzzleHttp\Psr7\Request
+ */
+ public function generateMessagingCodeRequest(
+ string $account_id,
+ \Bandwidth\Model\CodeRequest $code_request,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['generateMessagingCode'][0]
+ ): Request
+ {
+ // verify the required parameter 'account_id' is set
+ if ($account_id === null || (is_array($account_id) && count($account_id) === 0)) {
+ throw new InvalidArgumentException(
+ 'Missing the required parameter $account_id when calling generateMessagingCode'
+ );
+ }
+ // verify the required parameter 'code_request' is set
+ if ($code_request === null || (is_array($code_request) && count($code_request) === 0)) {
+ throw new InvalidArgumentException(
+ 'Missing the required parameter $code_request when calling generateMessagingCode'
+ );
+ }
+
+ $resourcePath = '/accounts/{accountId}/code/messaging';
+ $formParams = [];
+ $queryParams = [];
+ $headerParams = [];
+ $httpBody = '';
+ $multipart = false;
+
+
+
+ // path params
+ if ($account_id !== null) {
+ $resourcePath = str_replace(
+ '{accountId}',
+ ObjectSerializer::toPathValue($account_id),
+ $resourcePath
+ );
+ }
+
+
+ $headers = $this->headerSelector->selectHeaders(
+ ['application/json', ],
+ $contentType,
+ $multipart
+ );
+
+ // for model (json/xml)
+ if (isset($code_request)) {
+ if (stripos($headers['Content-Type'], 'application/json') !== false) {
+ # if Content-Type contains "application/json", json_encode the body
+ $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($code_request));
+ } else {
+ $httpBody = $code_request;
+ }
+ } elseif (count($formParams) > 0) {
+ if ($multipart) {
+ $multipartContents = [];
+ foreach ($formParams as $formParamName => $formParamValue) {
+ $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
+ foreach ($formParamValueItems as $formParamValueItem) {
+ $multipartContents[] = [
+ 'name' => $formParamName,
+ 'contents' => $formParamValueItem
+ ];
+ }
+ }
+ // for HTTP post (form)
+ $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents);
+
+ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
+ # if Content-Type contains "application/json", json_encode the form parameters
+ $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams);
+ } else {
+ // for HTTP post (form)
+ $httpBody = ObjectSerializer::buildQuery($formParams);
+ }
+ }
+
+ // this endpoint requires HTTP basic authentication
+ if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) {
+ $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword());
+ }
+
+ // this endpoint requires OAuth (access token)
+ if (!empty($this->config->getAccessToken())) {
+ $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken();
+ }
+
+ $defaultHeaders = [];
+ if ($this->config->getUserAgent()) {
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
+ }
+
+ $headers = array_merge(
+ $defaultHeaders,
+ $headerParams,
+ $headers
+ );
+
+ if ($this->config->getIgnoreOperationHosts()) {
+ $operationHost = $this->config->getHost();
+ } else {
+ # Preserve the original behavior of server indexing.
+ if ($hostIndex === null) {
+ $hostIndex = $this->hostIndex;
+ }
+
+ $hostSettings = $this->getHostSettingsForgenerateMessagingCode();
+
+ if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) {
+ throw new InvalidArgumentException("Invalid index {$hostIndex} when selecting the host. Must be less than ".count($hostSettings));
+ }
+ $operationHost = Configuration::getHostString($hostSettings, $hostIndex, $variables);
+ }
+ $query = ObjectSerializer::buildQuery($queryParams);
+ return new Request(
+ 'POST',
+ $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
+ $headers,
+ $httpBody
+ );
+ }
+
+ /**
+ * Returns an array of host settings for Operation generateMessagingCode
+ *
+ * @return array an array of host settings
+ */
+ protected function getHostSettingsForgenerateMessagingCode(): array
+ {
+ return [
+ [
+ "url" => "https://mfa.bandwidth.com/api/v1",
+ "description" => "Production",
+ ]
+ ];
+ }
+
+ /**
+ * Operation generateVoiceCode
+ *
+ * Voice Authentication Code
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://mfa.bandwidth.com/api/v1
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param \Bandwidth\Model\CodeRequest $code_request MFA code request body. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['generateVoiceCode'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return \Bandwidth\Model\VoiceCodeResponse|\Bandwidth\Model\MfaRequestError|\Bandwidth\Model\MfaUnauthorizedRequestError|\Bandwidth\Model\MfaForbiddenRequestError
+ */
+ public function generateVoiceCode(
+ string $account_id,
+ \Bandwidth\Model\CodeRequest $code_request,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['generateVoiceCode'][0]
+ ): \Bandwidth\Model\VoiceCodeResponse|\Bandwidth\Model\MfaRequestError|\Bandwidth\Model\MfaUnauthorizedRequestError|\Bandwidth\Model\MfaForbiddenRequestError
+ {
+ list($response) = $this->generateVoiceCodeWithHttpInfo($account_id, $code_request, $hostIndex, $variables, $contentType);
+ return $response;
+ }
+
+ /**
+ * Operation generateVoiceCodeWithHttpInfo
+ *
+ * Voice Authentication Code
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://mfa.bandwidth.com/api/v1
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param \Bandwidth\Model\CodeRequest $code_request MFA code request body. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['generateVoiceCode'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return array{0: \Bandwidth\Model\VoiceCodeResponse|\Bandwidth\Model\MfaRequestError|\Bandwidth\Model\MfaUnauthorizedRequestError|\Bandwidth\Model\MfaForbiddenRequestError, 1: int, 2: array} [response data, HTTP status code, HTTP response headers]
+ */
+ public function generateVoiceCodeWithHttpInfo(
+ string $account_id,
+ \Bandwidth\Model\CodeRequest $code_request,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['generateVoiceCode'][0]
+ ): array
+ {
+ $request = $this->generateVoiceCodeRequest($account_id, $code_request, $hostIndex, $variables, $contentType);
+
+ try {
+ $options = $this->createHttpClientOption();
+ try {
+ $response = $this->client->send($request, $options);
+ } catch (RequestException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
+ $e->getResponse() ? (string) $e->getResponse()->getBody() : null
+ );
+ } catch (ConnectException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ null,
+ null
+ );
+ }
+
+ $statusCode = $response->getStatusCode();
+
+ switch($statusCode) {
+ case 200:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\VoiceCodeResponse',
+ $request,
+ $response,
+ );
+ case 400:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\MfaRequestError',
+ $request,
+ $response,
+ );
+ case 401:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\MfaUnauthorizedRequestError',
+ $request,
+ $response,
+ );
+ case 403:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\MfaForbiddenRequestError',
+ $request,
+ $response,
+ );
+ case 500:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\MfaRequestError',
+ $request,
+ $response,
+ );
+ }
+
+ if ($statusCode < 200 || $statusCode > 299) {
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ (string) $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\VoiceCodeResponse',
+ $request,
+ $response,
+ );
+ } catch (ApiException $e) {
+ switch ($e->getCode()) {
+ case 200:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceCodeResponse',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 400:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\MfaRequestError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 401:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\MfaUnauthorizedRequestError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 403:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\MfaForbiddenRequestError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 500:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\MfaRequestError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ }
+
+ throw $e;
+ }
+ }
+
+ /**
+ * Operation generateVoiceCodeAsync
+ *
+ * Voice Authentication Code
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://mfa.bandwidth.com/api/v1
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param \Bandwidth\Model\CodeRequest $code_request MFA code request body. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['generateVoiceCode'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function generateVoiceCodeAsync(
+ string $account_id,
+ \Bandwidth\Model\CodeRequest $code_request,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['generateVoiceCode'][0]
+ ): PromiseInterface
+ {
+ return $this->generateVoiceCodeAsyncWithHttpInfo($account_id, $code_request, $hostIndex, $variables, $contentType)
+ ->then(
+ function ($response) {
+ return $response[0];
+ }
+ );
+ }
+
+ /**
+ * Operation generateVoiceCodeAsyncWithHttpInfo
+ *
+ * Voice Authentication Code
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://mfa.bandwidth.com/api/v1
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param \Bandwidth\Model\CodeRequest $code_request MFA code request body. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['generateVoiceCode'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function generateVoiceCodeAsyncWithHttpInfo(
+ string $account_id,
+ \Bandwidth\Model\CodeRequest $code_request,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['generateVoiceCode'][0]
+ ): PromiseInterface
+ {
+ $returnType = '\Bandwidth\Model\VoiceCodeResponse';
+ $request = $this->generateVoiceCodeRequest($account_id, $code_request, $hostIndex, $variables, $contentType);
+
+ return $this->client
+ ->sendAsync($request, $this->createHttpClientOption())
+ ->then(
+ function ($response) use ($returnType) {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ },
+ function ($exception) {
+ $response = $exception->getResponse();
+ $statusCode = $response->getStatusCode();
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ $exception->getRequest()->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+ );
+ }
+
+ /**
+ * Create request for operation 'generateVoiceCode'
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://mfa.bandwidth.com/api/v1
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param \Bandwidth\Model\CodeRequest $code_request MFA code request body. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['generateVoiceCode'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return \GuzzleHttp\Psr7\Request
+ */
+ public function generateVoiceCodeRequest(
+ string $account_id,
+ \Bandwidth\Model\CodeRequest $code_request,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['generateVoiceCode'][0]
+ ): Request
+ {
+ // verify the required parameter 'account_id' is set
+ if ($account_id === null || (is_array($account_id) && count($account_id) === 0)) {
+ throw new InvalidArgumentException(
+ 'Missing the required parameter $account_id when calling generateVoiceCode'
+ );
+ }
+ // verify the required parameter 'code_request' is set
+ if ($code_request === null || (is_array($code_request) && count($code_request) === 0)) {
+ throw new InvalidArgumentException(
+ 'Missing the required parameter $code_request when calling generateVoiceCode'
+ );
+ }
+
+ $resourcePath = '/accounts/{accountId}/code/voice';
+ $formParams = [];
+ $queryParams = [];
+ $headerParams = [];
+ $httpBody = '';
+ $multipart = false;
+
+
+
+ // path params
+ if ($account_id !== null) {
+ $resourcePath = str_replace(
+ '{accountId}',
+ ObjectSerializer::toPathValue($account_id),
+ $resourcePath
+ );
+ }
+
+
+ $headers = $this->headerSelector->selectHeaders(
+ ['application/json', ],
+ $contentType,
+ $multipart
+ );
+
+ // for model (json/xml)
+ if (isset($code_request)) {
+ if (stripos($headers['Content-Type'], 'application/json') !== false) {
+ # if Content-Type contains "application/json", json_encode the body
+ $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($code_request));
+ } else {
+ $httpBody = $code_request;
+ }
+ } elseif (count($formParams) > 0) {
+ if ($multipart) {
+ $multipartContents = [];
+ foreach ($formParams as $formParamName => $formParamValue) {
+ $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
+ foreach ($formParamValueItems as $formParamValueItem) {
+ $multipartContents[] = [
+ 'name' => $formParamName,
+ 'contents' => $formParamValueItem
+ ];
+ }
+ }
+ // for HTTP post (form)
+ $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents);
+
+ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
+ # if Content-Type contains "application/json", json_encode the form parameters
+ $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams);
+ } else {
+ // for HTTP post (form)
+ $httpBody = ObjectSerializer::buildQuery($formParams);
+ }
+ }
+
+ // this endpoint requires HTTP basic authentication
+ if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) {
+ $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword());
+ }
+
+ // this endpoint requires OAuth (access token)
+ if (!empty($this->config->getAccessToken())) {
+ $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken();
+ }
+
+ $defaultHeaders = [];
+ if ($this->config->getUserAgent()) {
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
+ }
+
+ $headers = array_merge(
+ $defaultHeaders,
+ $headerParams,
+ $headers
+ );
+
+ if ($this->config->getIgnoreOperationHosts()) {
+ $operationHost = $this->config->getHost();
+ } else {
+ # Preserve the original behavior of server indexing.
+ if ($hostIndex === null) {
+ $hostIndex = $this->hostIndex;
+ }
+
+ $hostSettings = $this->getHostSettingsForgenerateVoiceCode();
+
+ if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) {
+ throw new InvalidArgumentException("Invalid index {$hostIndex} when selecting the host. Must be less than ".count($hostSettings));
+ }
+ $operationHost = Configuration::getHostString($hostSettings, $hostIndex, $variables);
+ }
+ $query = ObjectSerializer::buildQuery($queryParams);
+ return new Request(
+ 'POST',
+ $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
+ $headers,
+ $httpBody
+ );
+ }
+
+ /**
+ * Returns an array of host settings for Operation generateVoiceCode
+ *
+ * @return array an array of host settings
+ */
+ protected function getHostSettingsForgenerateVoiceCode(): array
+ {
+ return [
+ [
+ "url" => "https://mfa.bandwidth.com/api/v1",
+ "description" => "Production",
+ ]
+ ];
+ }
+
+ /**
+ * Operation verifyCode
+ *
+ * Verify Authentication Code
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://mfa.bandwidth.com/api/v1
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param \Bandwidth\Model\VerifyCodeRequest $verify_code_request MFA code verify request body. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['verifyCode'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return \Bandwidth\Model\VerifyCodeResponse|\Bandwidth\Model\MfaRequestError|\Bandwidth\Model\MfaUnauthorizedRequestError|\Bandwidth\Model\MfaForbiddenRequestError
+ */
+ public function verifyCode(
+ string $account_id,
+ \Bandwidth\Model\VerifyCodeRequest $verify_code_request,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['verifyCode'][0]
+ ): \Bandwidth\Model\VerifyCodeResponse|\Bandwidth\Model\MfaRequestError|\Bandwidth\Model\MfaUnauthorizedRequestError|\Bandwidth\Model\MfaForbiddenRequestError
+ {
+ list($response) = $this->verifyCodeWithHttpInfo($account_id, $verify_code_request, $hostIndex, $variables, $contentType);
+ return $response;
+ }
+
+ /**
+ * Operation verifyCodeWithHttpInfo
+ *
+ * Verify Authentication Code
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://mfa.bandwidth.com/api/v1
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param \Bandwidth\Model\VerifyCodeRequest $verify_code_request MFA code verify request body. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['verifyCode'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return array{0: \Bandwidth\Model\VerifyCodeResponse|\Bandwidth\Model\MfaRequestError|\Bandwidth\Model\MfaUnauthorizedRequestError|\Bandwidth\Model\MfaForbiddenRequestError, 1: int, 2: array} [response data, HTTP status code, HTTP response headers]
+ */
+ public function verifyCodeWithHttpInfo(
+ string $account_id,
+ \Bandwidth\Model\VerifyCodeRequest $verify_code_request,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['verifyCode'][0]
+ ): array
+ {
+ $request = $this->verifyCodeRequest($account_id, $verify_code_request, $hostIndex, $variables, $contentType);
+
+ try {
+ $options = $this->createHttpClientOption();
+ try {
+ $response = $this->client->send($request, $options);
+ } catch (RequestException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
+ $e->getResponse() ? (string) $e->getResponse()->getBody() : null
+ );
+ } catch (ConnectException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ null,
+ null
+ );
+ }
+
+ $statusCode = $response->getStatusCode();
+
+ switch($statusCode) {
+ case 200:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\VerifyCodeResponse',
+ $request,
+ $response,
+ );
+ case 400:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\MfaRequestError',
+ $request,
+ $response,
+ );
+ case 401:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\MfaUnauthorizedRequestError',
+ $request,
+ $response,
+ );
+ case 403:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\MfaForbiddenRequestError',
+ $request,
+ $response,
+ );
+ case 429:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\MfaRequestError',
+ $request,
+ $response,
+ );
+ case 500:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\MfaRequestError',
+ $request,
+ $response,
+ );
+ }
+
+ if ($statusCode < 200 || $statusCode > 299) {
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ (string) $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\VerifyCodeResponse',
+ $request,
+ $response,
+ );
+ } catch (ApiException $e) {
+ switch ($e->getCode()) {
+ case 200:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VerifyCodeResponse',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 400:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\MfaRequestError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 401:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\MfaUnauthorizedRequestError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 403:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\MfaForbiddenRequestError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 429:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\MfaRequestError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 500:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\MfaRequestError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ }
+
+ throw $e;
+ }
+ }
+
+ /**
+ * Operation verifyCodeAsync
+ *
+ * Verify Authentication Code
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://mfa.bandwidth.com/api/v1
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param \Bandwidth\Model\VerifyCodeRequest $verify_code_request MFA code verify request body. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['verifyCode'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function verifyCodeAsync(
+ string $account_id,
+ \Bandwidth\Model\VerifyCodeRequest $verify_code_request,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['verifyCode'][0]
+ ): PromiseInterface
+ {
+ return $this->verifyCodeAsyncWithHttpInfo($account_id, $verify_code_request, $hostIndex, $variables, $contentType)
+ ->then(
+ function ($response) {
+ return $response[0];
+ }
+ );
+ }
+
+ /**
+ * Operation verifyCodeAsyncWithHttpInfo
+ *
+ * Verify Authentication Code
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://mfa.bandwidth.com/api/v1
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param \Bandwidth\Model\VerifyCodeRequest $verify_code_request MFA code verify request body. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['verifyCode'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function verifyCodeAsyncWithHttpInfo(
+ string $account_id,
+ \Bandwidth\Model\VerifyCodeRequest $verify_code_request,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['verifyCode'][0]
+ ): PromiseInterface
+ {
+ $returnType = '\Bandwidth\Model\VerifyCodeResponse';
+ $request = $this->verifyCodeRequest($account_id, $verify_code_request, $hostIndex, $variables, $contentType);
+
+ return $this->client
+ ->sendAsync($request, $this->createHttpClientOption())
+ ->then(
+ function ($response) use ($returnType) {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ },
+ function ($exception) {
+ $response = $exception->getResponse();
+ $statusCode = $response->getStatusCode();
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ $exception->getRequest()->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+ );
+ }
+
+ /**
+ * Create request for operation 'verifyCode'
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://mfa.bandwidth.com/api/v1
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param \Bandwidth\Model\VerifyCodeRequest $verify_code_request MFA code verify request body. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['verifyCode'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return \GuzzleHttp\Psr7\Request
+ */
+ public function verifyCodeRequest(
+ string $account_id,
+ \Bandwidth\Model\VerifyCodeRequest $verify_code_request,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['verifyCode'][0]
+ ): Request
+ {
+ // verify the required parameter 'account_id' is set
+ if ($account_id === null || (is_array($account_id) && count($account_id) === 0)) {
+ throw new InvalidArgumentException(
+ 'Missing the required parameter $account_id when calling verifyCode'
+ );
+ }
+ // verify the required parameter 'verify_code_request' is set
+ if ($verify_code_request === null || (is_array($verify_code_request) && count($verify_code_request) === 0)) {
+ throw new InvalidArgumentException(
+ 'Missing the required parameter $verify_code_request when calling verifyCode'
+ );
+ }
+
+ $resourcePath = '/accounts/{accountId}/code/verify';
+ $formParams = [];
+ $queryParams = [];
+ $headerParams = [];
+ $httpBody = '';
+ $multipart = false;
+
+
+
+ // path params
+ if ($account_id !== null) {
+ $resourcePath = str_replace(
+ '{accountId}',
+ ObjectSerializer::toPathValue($account_id),
+ $resourcePath
+ );
+ }
+
+
+ $headers = $this->headerSelector->selectHeaders(
+ ['application/json', ],
+ $contentType,
+ $multipart
+ );
+
+ // for model (json/xml)
+ if (isset($verify_code_request)) {
+ if (stripos($headers['Content-Type'], 'application/json') !== false) {
+ # if Content-Type contains "application/json", json_encode the body
+ $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($verify_code_request));
+ } else {
+ $httpBody = $verify_code_request;
+ }
+ } elseif (count($formParams) > 0) {
+ if ($multipart) {
+ $multipartContents = [];
+ foreach ($formParams as $formParamName => $formParamValue) {
+ $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
+ foreach ($formParamValueItems as $formParamValueItem) {
+ $multipartContents[] = [
+ 'name' => $formParamName,
+ 'contents' => $formParamValueItem
+ ];
+ }
+ }
+ // for HTTP post (form)
+ $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents);
+
+ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
+ # if Content-Type contains "application/json", json_encode the form parameters
+ $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams);
+ } else {
+ // for HTTP post (form)
+ $httpBody = ObjectSerializer::buildQuery($formParams);
+ }
+ }
+
+ // this endpoint requires HTTP basic authentication
+ if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) {
+ $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword());
+ }
+
+ // this endpoint requires OAuth (access token)
+ if (!empty($this->config->getAccessToken())) {
+ $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken();
+ }
+
+ $defaultHeaders = [];
+ if ($this->config->getUserAgent()) {
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
+ }
+
+ $headers = array_merge(
+ $defaultHeaders,
+ $headerParams,
+ $headers
+ );
+
+ if ($this->config->getIgnoreOperationHosts()) {
+ $operationHost = $this->config->getHost();
+ } else {
+ # Preserve the original behavior of server indexing.
+ if ($hostIndex === null) {
+ $hostIndex = $this->hostIndex;
+ }
+
+ $hostSettings = $this->getHostSettingsForverifyCode();
+
+ if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) {
+ throw new InvalidArgumentException("Invalid index {$hostIndex} when selecting the host. Must be less than ".count($hostSettings));
+ }
+ $operationHost = Configuration::getHostString($hostSettings, $hostIndex, $variables);
+ }
+ $query = ObjectSerializer::buildQuery($queryParams);
+ return new Request(
+ 'POST',
+ $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
+ $headers,
+ $httpBody
+ );
+ }
+
+ /**
+ * Returns an array of host settings for Operation verifyCode
+ *
+ * @return array an array of host settings
+ */
+ protected function getHostSettingsForverifyCode(): array
+ {
+ return [
+ [
+ "url" => "https://mfa.bandwidth.com/api/v1",
+ "description" => "Production",
+ ]
+ ];
+ }
+
+ /**
+ * Create http client option
+ *
+ * @throws \RuntimeException on file opening failure
+ * @return array of http client options
+ */
+ protected function createHttpClientOption(): array
+ {
+ $options = [];
+ if ($this->config->getDebug()) {
+ $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a');
+ if (!$options[RequestOptions::DEBUG]) {
+ throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile());
+ }
+ }
+
+ return $options;
+ }
+
+ private function handleResponseWithDataType(
+ string $dataType,
+ RequestInterface $request,
+ ResponseInterface $response,
+ ): array {
+ if (in_array($dataType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($dataType !== 'string') {
+ try {
+ $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR);
+ } catch (\JsonException $exception) {
+ throw new ApiException(
+ sprintf(
+ 'Error JSON decoding server response (%s)',
+ $request->getUri()
+ ),
+ $response->getStatusCode(),
+ $response->getHeaders(),
+ $content
+ );
+ }
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $dataType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ }
+
+ private function responseWithinRangeCode(
+ string $rangeCode,
+ int $statusCode,
+ ): bool {
+ $left = (int) ($rangeCode[0].'00');
+ $right = (int) ($rangeCode[0].'99');
+
+ return $statusCode >= $left && $statusCode <= $right;
+ }
+}
diff --git a/src/Api/MediaApi.php b/src/Api/MediaApi.php
new file mode 100644
index 0000000..2bfc4dd
--- /dev/null
+++ b/src/Api/MediaApi.php
@@ -0,0 +1,1986 @@
+ $contentTypes **/
+ public const contentTypes = [
+ 'deleteMedia' => [
+ 'application/json',
+ ],
+ 'getMedia' => [
+ 'application/json',
+ ],
+ 'listMedia' => [
+ 'application/json',
+ ],
+ 'uploadMedia' => [
+ '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',
+ ],
+ ];
+
+ /**
+ * @param ClientInterface|null $client
+ * @param Configuration|null $config
+ * @param HeaderSelector|null $selector
+ * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec
+ */
+ public function __construct(
+ ?ClientInterface $client = null,
+ ?Configuration $config = null,
+ ?HeaderSelector $selector = null,
+ int $hostIndex = 0
+ ) {
+ $this->client = $client ?: new Client();
+ $this->config = $config ?: Configuration::getDefaultConfiguration();
+ $this->headerSelector = $selector ?: new HeaderSelector();
+ $this->hostIndex = $hostIndex;
+ }
+
+ /**
+ * Set the host index
+ *
+ * @param int $hostIndex Host index (required)
+ */
+ public function setHostIndex(int $hostIndex): void
+ {
+ $this->hostIndex = $hostIndex;
+ }
+
+ /**
+ * Get the host index
+ *
+ * @return int Host index
+ */
+ public function getHostIndex(): int
+ {
+ return $this->hostIndex;
+ }
+
+ /**
+ * @return Configuration
+ */
+ public function getConfig(): Configuration
+ {
+ return $this->config;
+ }
+
+ /**
+ * Operation deleteMedia
+ *
+ * Delete Media
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://messaging.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $media_id Media ID to retrieve. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteMedia'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return \Bandwidth\Model\MessagingRequestError|null
+ */
+ public function deleteMedia(
+ string $account_id,
+ string $media_id,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['deleteMedia'][0]
+ ): ?\Bandwidth\Model\MessagingRequestError
+ {
+ list($response) = $this->deleteMediaWithHttpInfo($account_id, $media_id, $hostIndex, $variables, $contentType);
+ return $response;
+ }
+
+ /**
+ * Operation deleteMediaWithHttpInfo
+ *
+ * Delete Media
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://messaging.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $media_id Media ID to retrieve. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteMedia'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return array{0: null, 1: int, 2: array} [response data, HTTP status code, HTTP response headers]
+ */
+ public function deleteMediaWithHttpInfo(
+ string $account_id,
+ string $media_id,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['deleteMedia'][0]
+ ): array
+ {
+ $request = $this->deleteMediaRequest($account_id, $media_id, $hostIndex, $variables, $contentType);
+
+ try {
+ $options = $this->createHttpClientOption();
+ try {
+ $response = $this->client->send($request, $options);
+ } catch (RequestException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
+ $e->getResponse() ? (string) $e->getResponse()->getBody() : null
+ );
+ } catch (ConnectException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ null,
+ null
+ );
+ }
+
+ $statusCode = $response->getStatusCode();
+
+
+ return [null, $statusCode, $response->getHeaders()];
+ } catch (ApiException $e) {
+ switch ($e->getCode()) {
+ case 400:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\MessagingRequestError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 401:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\MessagingRequestError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 403:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\MessagingRequestError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 404:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\MessagingRequestError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 406:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\MessagingRequestError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 415:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\MessagingRequestError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 429:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\MessagingRequestError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 500:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\MessagingRequestError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ }
+
+ throw $e;
+ }
+ }
+
+ /**
+ * Operation deleteMediaAsync
+ *
+ * Delete Media
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://messaging.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $media_id Media ID to retrieve. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteMedia'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function deleteMediaAsync(
+ string $account_id,
+ string $media_id,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['deleteMedia'][0]
+ ): PromiseInterface
+ {
+ return $this->deleteMediaAsyncWithHttpInfo($account_id, $media_id, $hostIndex, $variables, $contentType)
+ ->then(
+ function ($response) {
+ return $response[0];
+ }
+ );
+ }
+
+ /**
+ * Operation deleteMediaAsyncWithHttpInfo
+ *
+ * Delete Media
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://messaging.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $media_id Media ID to retrieve. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteMedia'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function deleteMediaAsyncWithHttpInfo(
+ string $account_id,
+ string $media_id,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['deleteMedia'][0]
+ ): PromiseInterface
+ {
+ $returnType = '';
+ $request = $this->deleteMediaRequest($account_id, $media_id, $hostIndex, $variables, $contentType);
+
+ return $this->client
+ ->sendAsync($request, $this->createHttpClientOption())
+ ->then(
+ function ($response) use ($returnType) {
+ return [null, $response->getStatusCode(), $response->getHeaders()];
+ },
+ function ($exception) {
+ $response = $exception->getResponse();
+ $statusCode = $response->getStatusCode();
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ $exception->getRequest()->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+ );
+ }
+
+ /**
+ * Create request for operation 'deleteMedia'
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://messaging.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $media_id Media ID to retrieve. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteMedia'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return \GuzzleHttp\Psr7\Request
+ */
+ public function deleteMediaRequest(
+ string $account_id,
+ string $media_id,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['deleteMedia'][0]
+ ): Request
+ {
+ // verify the required parameter 'account_id' is set
+ if ($account_id === null || (is_array($account_id) && count($account_id) === 0)) {
+ throw new InvalidArgumentException(
+ 'Missing the required parameter $account_id when calling deleteMedia'
+ );
+ }
+ // verify the required parameter 'media_id' is set
+ if ($media_id === null || (is_array($media_id) && count($media_id) === 0)) {
+ throw new InvalidArgumentException(
+ 'Missing the required parameter $media_id when calling deleteMedia'
+ );
+ }
+
+ $resourcePath = '/users/{accountId}/media/{mediaId}';
+ $queryParams = [];
+ $headerParams = [];
+ $httpBody = '';
+ $multipart = false;
+
+
+
+ // path params
+ if ($account_id !== null) {
+ $resourcePath = str_replace(
+ '{accountId}',
+ ObjectSerializer::toPathValue($account_id),
+ $resourcePath
+ );
+ }
+ // path params
+ if ($media_id !== null) {
+ $resourcePath = str_replace(
+ '{mediaId}',
+ ObjectSerializer::toPathValue($media_id),
+ $resourcePath
+ );
+ }
+
+
+ $headers = $this->headerSelector->selectHeaders(
+ ['application/json', ],
+ $contentType,
+ $multipart
+ );
+
+
+ // this endpoint requires HTTP basic authentication
+ if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) {
+ $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword());
+ }
+
+ // this endpoint requires OAuth (access token)
+ if (!empty($this->config->getAccessToken())) {
+ $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken();
+ }
+
+ $defaultHeaders = [];
+ if ($this->config->getUserAgent()) {
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
+ }
+
+ $headers = array_merge(
+ $defaultHeaders,
+ $headerParams,
+ $headers
+ );
+
+ if ($this->config->getIgnoreOperationHosts()) {
+ $operationHost = $this->config->getHost();
+ } else {
+ # Preserve the original behavior of server indexing.
+ if ($hostIndex === null) {
+ $hostIndex = $this->hostIndex;
+ }
+
+ $hostSettings = $this->getHostSettingsFordeleteMedia();
+
+ if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) {
+ throw new InvalidArgumentException("Invalid index {$hostIndex} when selecting the host. Must be less than ".count($hostSettings));
+ }
+ $operationHost = Configuration::getHostString($hostSettings, $hostIndex, $variables);
+ }
+ $query = ObjectSerializer::buildQuery($queryParams);
+ return new Request(
+ 'DELETE',
+ $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
+ $headers,
+ $httpBody
+ );
+ }
+
+ /**
+ * Returns an array of host settings for Operation deleteMedia
+ *
+ * @return array an array of host settings
+ */
+ protected function getHostSettingsFordeleteMedia(): array
+ {
+ return [
+ [
+ "url" => "https://messaging.bandwidth.com/api/v2",
+ "description" => "Production",
+ ]
+ ];
+ }
+
+ /**
+ * Operation getMedia
+ *
+ * Get Media
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://messaging.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $media_id Media ID to retrieve. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getMedia'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return \SplFileObject|\Bandwidth\Model\MessagingRequestError
+ */
+ public function getMedia(
+ string $account_id,
+ string $media_id,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['getMedia'][0]
+ ): \SplFileObject|\Bandwidth\Model\MessagingRequestError
+ {
+ list($response) = $this->getMediaWithHttpInfo($account_id, $media_id, $hostIndex, $variables, $contentType);
+ return $response;
+ }
+
+ /**
+ * Operation getMediaWithHttpInfo
+ *
+ * Get Media
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://messaging.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $media_id Media ID to retrieve. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getMedia'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return array{0: \SplFileObject|\Bandwidth\Model\MessagingRequestError, 1: int, 2: array} [response data, HTTP status code, HTTP response headers]
+ */
+ public function getMediaWithHttpInfo(
+ string $account_id,
+ string $media_id,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['getMedia'][0]
+ ): array
+ {
+ $request = $this->getMediaRequest($account_id, $media_id, $hostIndex, $variables, $contentType);
+
+ try {
+ $options = $this->createHttpClientOption();
+ try {
+ $response = $this->client->send($request, $options);
+ } catch (RequestException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
+ $e->getResponse() ? (string) $e->getResponse()->getBody() : null
+ );
+ } catch (ConnectException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ null,
+ null
+ );
+ }
+
+ $statusCode = $response->getStatusCode();
+
+ switch($statusCode) {
+ case 200:
+ return $this->handleResponseWithDataType(
+ '\SplFileObject',
+ $request,
+ $response,
+ );
+ case 400:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\MessagingRequestError',
+ $request,
+ $response,
+ );
+ case 401:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\MessagingRequestError',
+ $request,
+ $response,
+ );
+ case 403:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\MessagingRequestError',
+ $request,
+ $response,
+ );
+ case 404:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\MessagingRequestError',
+ $request,
+ $response,
+ );
+ case 406:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\MessagingRequestError',
+ $request,
+ $response,
+ );
+ case 415:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\MessagingRequestError',
+ $request,
+ $response,
+ );
+ case 429:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\MessagingRequestError',
+ $request,
+ $response,
+ );
+ case 500:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\MessagingRequestError',
+ $request,
+ $response,
+ );
+ }
+
+ if ($statusCode < 200 || $statusCode > 299) {
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ (string) $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+
+ return $this->handleResponseWithDataType(
+ '\SplFileObject',
+ $request,
+ $response,
+ );
+ } catch (ApiException $e) {
+ switch ($e->getCode()) {
+ case 200:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\SplFileObject',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 400:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\MessagingRequestError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 401:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\MessagingRequestError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 403:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\MessagingRequestError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 404:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\MessagingRequestError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 406:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\MessagingRequestError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 415:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\MessagingRequestError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 429:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\MessagingRequestError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 500:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\MessagingRequestError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ }
+
+ throw $e;
+ }
+ }
+
+ /**
+ * Operation getMediaAsync
+ *
+ * Get Media
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://messaging.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $media_id Media ID to retrieve. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getMedia'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function getMediaAsync(
+ string $account_id,
+ string $media_id,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['getMedia'][0]
+ ): PromiseInterface
+ {
+ return $this->getMediaAsyncWithHttpInfo($account_id, $media_id, $hostIndex, $variables, $contentType)
+ ->then(
+ function ($response) {
+ return $response[0];
+ }
+ );
+ }
+
+ /**
+ * Operation getMediaAsyncWithHttpInfo
+ *
+ * Get Media
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://messaging.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $media_id Media ID to retrieve. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getMedia'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function getMediaAsyncWithHttpInfo(
+ string $account_id,
+ string $media_id,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['getMedia'][0]
+ ): PromiseInterface
+ {
+ $returnType = '\SplFileObject';
+ $request = $this->getMediaRequest($account_id, $media_id, $hostIndex, $variables, $contentType);
+
+ return $this->client
+ ->sendAsync($request, $this->createHttpClientOption())
+ ->then(
+ function ($response) use ($returnType) {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ },
+ function ($exception) {
+ $response = $exception->getResponse();
+ $statusCode = $response->getStatusCode();
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ $exception->getRequest()->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+ );
+ }
+
+ /**
+ * Create request for operation 'getMedia'
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://messaging.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $media_id Media ID to retrieve. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getMedia'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return \GuzzleHttp\Psr7\Request
+ */
+ public function getMediaRequest(
+ string $account_id,
+ string $media_id,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['getMedia'][0]
+ ): Request
+ {
+ // verify the required parameter 'account_id' is set
+ if ($account_id === null || (is_array($account_id) && count($account_id) === 0)) {
+ throw new InvalidArgumentException(
+ 'Missing the required parameter $account_id when calling getMedia'
+ );
+ }
+ // verify the required parameter 'media_id' is set
+ if ($media_id === null || (is_array($media_id) && count($media_id) === 0)) {
+ throw new InvalidArgumentException(
+ 'Missing the required parameter $media_id when calling getMedia'
+ );
+ }
+
+ $resourcePath = '/users/{accountId}/media/{mediaId}';
+ $queryParams = [];
+ $headerParams = [];
+ $httpBody = '';
+ $multipart = false;
+
+
+
+ // path params
+ if ($account_id !== null) {
+ $resourcePath = str_replace(
+ '{accountId}',
+ ObjectSerializer::toPathValue($account_id),
+ $resourcePath
+ );
+ }
+ // path params
+ if ($media_id !== null) {
+ $resourcePath = str_replace(
+ '{mediaId}',
+ ObjectSerializer::toPathValue($media_id),
+ $resourcePath
+ );
+ }
+
+
+ $headers = $this->headerSelector->selectHeaders(
+ ['application/octet-stream', 'application/json', ],
+ $contentType,
+ $multipart
+ );
+
+
+ // this endpoint requires HTTP basic authentication
+ if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) {
+ $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword());
+ }
+
+ // this endpoint requires OAuth (access token)
+ if (!empty($this->config->getAccessToken())) {
+ $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken();
+ }
+
+ $defaultHeaders = [];
+ if ($this->config->getUserAgent()) {
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
+ }
+
+ $headers = array_merge(
+ $defaultHeaders,
+ $headerParams,
+ $headers
+ );
+
+ if ($this->config->getIgnoreOperationHosts()) {
+ $operationHost = $this->config->getHost();
+ } else {
+ # Preserve the original behavior of server indexing.
+ if ($hostIndex === null) {
+ $hostIndex = $this->hostIndex;
+ }
+
+ $hostSettings = $this->getHostSettingsForgetMedia();
+
+ if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) {
+ throw new InvalidArgumentException("Invalid index {$hostIndex} when selecting the host. Must be less than ".count($hostSettings));
+ }
+ $operationHost = Configuration::getHostString($hostSettings, $hostIndex, $variables);
+ }
+ $query = ObjectSerializer::buildQuery($queryParams);
+ return new Request(
+ 'GET',
+ $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
+ $headers,
+ $httpBody
+ );
+ }
+
+ /**
+ * Returns an array of host settings for Operation getMedia
+ *
+ * @return array an array of host settings
+ */
+ protected function getHostSettingsForgetMedia(): array
+ {
+ return [
+ [
+ "url" => "https://messaging.bandwidth.com/api/v2",
+ "description" => "Production",
+ ]
+ ];
+ }
+
+ /**
+ * Operation listMedia
+ *
+ * List Media
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://messaging.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string|null $continuation_token Continuation token used to retrieve subsequent media. (optional)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listMedia'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return \Bandwidth\Model\Media[]|\Bandwidth\Model\MessagingRequestError
+ */
+ public function listMedia(
+ string $account_id,
+ ?string $continuation_token = null,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['listMedia'][0]
+ ): array|\Bandwidth\Model\MessagingRequestError
+ {
+ list($response) = $this->listMediaWithHttpInfo($account_id, $continuation_token, $hostIndex, $variables, $contentType);
+ return $response;
+ }
+
+ /**
+ * Operation listMediaWithHttpInfo
+ *
+ * List Media
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://messaging.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string|null $continuation_token Continuation token used to retrieve subsequent media. (optional)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listMedia'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return array{0: \Bandwidth\Model\Media[]|\Bandwidth\Model\MessagingRequestError, 1: int, 2: array} [response data, HTTP status code, HTTP response headers]
+ */
+ public function listMediaWithHttpInfo(
+ string $account_id,
+ ?string $continuation_token = null,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['listMedia'][0]
+ ): array
+ {
+ $request = $this->listMediaRequest($account_id, $continuation_token, $hostIndex, $variables, $contentType);
+
+ try {
+ $options = $this->createHttpClientOption();
+ try {
+ $response = $this->client->send($request, $options);
+ } catch (RequestException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
+ $e->getResponse() ? (string) $e->getResponse()->getBody() : null
+ );
+ } catch (ConnectException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ null,
+ null
+ );
+ }
+
+ $statusCode = $response->getStatusCode();
+
+ switch($statusCode) {
+ case 200:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\Media[]',
+ $request,
+ $response,
+ );
+ case 400:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\MessagingRequestError',
+ $request,
+ $response,
+ );
+ case 401:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\MessagingRequestError',
+ $request,
+ $response,
+ );
+ case 403:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\MessagingRequestError',
+ $request,
+ $response,
+ );
+ case 404:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\MessagingRequestError',
+ $request,
+ $response,
+ );
+ case 406:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\MessagingRequestError',
+ $request,
+ $response,
+ );
+ case 415:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\MessagingRequestError',
+ $request,
+ $response,
+ );
+ case 429:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\MessagingRequestError',
+ $request,
+ $response,
+ );
+ case 500:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\MessagingRequestError',
+ $request,
+ $response,
+ );
+ }
+
+ if ($statusCode < 200 || $statusCode > 299) {
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ (string) $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\Media[]',
+ $request,
+ $response,
+ );
+ } catch (ApiException $e) {
+ switch ($e->getCode()) {
+ case 200:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\Media[]',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 400:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\MessagingRequestError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 401:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\MessagingRequestError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 403:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\MessagingRequestError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 404:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\MessagingRequestError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 406:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\MessagingRequestError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 415:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\MessagingRequestError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 429:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\MessagingRequestError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 500:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\MessagingRequestError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ }
+
+ throw $e;
+ }
+ }
+
+ /**
+ * Operation listMediaAsync
+ *
+ * List Media
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://messaging.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string|null $continuation_token Continuation token used to retrieve subsequent media. (optional)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listMedia'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function listMediaAsync(
+ string $account_id,
+ ?string $continuation_token = null,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['listMedia'][0]
+ ): PromiseInterface
+ {
+ return $this->listMediaAsyncWithHttpInfo($account_id, $continuation_token, $hostIndex, $variables, $contentType)
+ ->then(
+ function ($response) {
+ return $response[0];
+ }
+ );
+ }
+
+ /**
+ * Operation listMediaAsyncWithHttpInfo
+ *
+ * List Media
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://messaging.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string|null $continuation_token Continuation token used to retrieve subsequent media. (optional)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listMedia'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function listMediaAsyncWithHttpInfo(
+ string $account_id,
+ ?string $continuation_token = null,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['listMedia'][0]
+ ): PromiseInterface
+ {
+ $returnType = '\Bandwidth\Model\Media[]';
+ $request = $this->listMediaRequest($account_id, $continuation_token, $hostIndex, $variables, $contentType);
+
+ return $this->client
+ ->sendAsync($request, $this->createHttpClientOption())
+ ->then(
+ function ($response) use ($returnType) {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ },
+ function ($exception) {
+ $response = $exception->getResponse();
+ $statusCode = $response->getStatusCode();
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ $exception->getRequest()->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+ );
+ }
+
+ /**
+ * Create request for operation 'listMedia'
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://messaging.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string|null $continuation_token Continuation token used to retrieve subsequent media. (optional)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listMedia'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return \GuzzleHttp\Psr7\Request
+ */
+ public function listMediaRequest(
+ string $account_id,
+ ?string $continuation_token = null,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['listMedia'][0]
+ ): Request
+ {
+ // verify the required parameter 'account_id' is set
+ if ($account_id === null || (is_array($account_id) && count($account_id) === 0)) {
+ throw new InvalidArgumentException(
+ 'Missing the required parameter $account_id when calling listMedia'
+ );
+ }
+
+ $resourcePath = '/users/{accountId}/media';
+ $queryParams = [];
+ $headerParams = [];
+ $httpBody = '';
+ $multipart = false;
+
+
+ // header params
+ if ($continuation_token !== null) {
+ $headerParams['Continuation-Token'] = ObjectSerializer::toHeaderValue($continuation_token);
+ }
+
+ // path params
+ if ($account_id !== null) {
+ $resourcePath = str_replace(
+ '{accountId}',
+ ObjectSerializer::toPathValue($account_id),
+ $resourcePath
+ );
+ }
+
+
+ $headers = $this->headerSelector->selectHeaders(
+ ['application/json', ],
+ $contentType,
+ $multipart
+ );
+
+
+ // this endpoint requires HTTP basic authentication
+ if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) {
+ $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword());
+ }
+
+ // this endpoint requires OAuth (access token)
+ if (!empty($this->config->getAccessToken())) {
+ $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken();
+ }
+
+ $defaultHeaders = [];
+ if ($this->config->getUserAgent()) {
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
+ }
+
+ $headers = array_merge(
+ $defaultHeaders,
+ $headerParams,
+ $headers
+ );
+
+ if ($this->config->getIgnoreOperationHosts()) {
+ $operationHost = $this->config->getHost();
+ } else {
+ # Preserve the original behavior of server indexing.
+ if ($hostIndex === null) {
+ $hostIndex = $this->hostIndex;
+ }
+
+ $hostSettings = $this->getHostSettingsForlistMedia();
+
+ if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) {
+ throw new InvalidArgumentException("Invalid index {$hostIndex} when selecting the host. Must be less than ".count($hostSettings));
+ }
+ $operationHost = Configuration::getHostString($hostSettings, $hostIndex, $variables);
+ }
+ $query = ObjectSerializer::buildQuery($queryParams);
+ return new Request(
+ 'GET',
+ $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
+ $headers,
+ $httpBody
+ );
+ }
+
+ /**
+ * Returns an array of host settings for Operation listMedia
+ *
+ * @return array an array of host settings
+ */
+ protected function getHostSettingsForlistMedia(): array
+ {
+ return [
+ [
+ "url" => "https://messaging.bandwidth.com/api/v2",
+ "description" => "Production",
+ ]
+ ];
+ }
+
+ /**
+ * Operation uploadMedia
+ *
+ * Upload Media
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://messaging.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $media_id Media ID to retrieve. (required)
+ * @param \SplFileObject $body body (required)
+ * @param string|null $content_type The media type of the entity-body. (optional)
+ * @param string|null $cache_control General-header field is used to specify directives that MUST be obeyed by all caching mechanisms along the request/response chain. (optional)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['uploadMedia'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return \Bandwidth\Model\MessagingRequestError|null
+ */
+ public function uploadMedia(
+ string $account_id,
+ string $media_id,
+ \SplFileObject $body,
+ ?string $content_type = null,
+ ?string $cache_control = null,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['uploadMedia'][0]
+ ): ?\Bandwidth\Model\MessagingRequestError
+ {
+ list($response) = $this->uploadMediaWithHttpInfo($account_id, $media_id, $body, $content_type, $cache_control, $hostIndex, $variables, $contentType);
+ return $response;
+ }
+
+ /**
+ * Operation uploadMediaWithHttpInfo
+ *
+ * Upload Media
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://messaging.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $media_id Media ID to retrieve. (required)
+ * @param \SplFileObject $body (required)
+ * @param string|null $content_type The media type of the entity-body. (optional)
+ * @param string|null $cache_control General-header field is used to specify directives that MUST be obeyed by all caching mechanisms along the request/response chain. (optional)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['uploadMedia'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return array{0: null, 1: int, 2: array} [response data, HTTP status code, HTTP response headers]
+ */
+ public function uploadMediaWithHttpInfo(
+ string $account_id,
+ string $media_id,
+ \SplFileObject $body,
+ ?string $content_type = null,
+ ?string $cache_control = null,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['uploadMedia'][0]
+ ): array
+ {
+ $request = $this->uploadMediaRequest($account_id, $media_id, $body, $content_type, $cache_control, $hostIndex, $variables, $contentType);
+
+ try {
+ $options = $this->createHttpClientOption();
+ try {
+ $response = $this->client->send($request, $options);
+ } catch (RequestException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
+ $e->getResponse() ? (string) $e->getResponse()->getBody() : null
+ );
+ } catch (ConnectException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ null,
+ null
+ );
+ }
+
+ $statusCode = $response->getStatusCode();
+
+
+ return [null, $statusCode, $response->getHeaders()];
+ } catch (ApiException $e) {
+ switch ($e->getCode()) {
+ case 400:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\MessagingRequestError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 401:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\MessagingRequestError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 403:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\MessagingRequestError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 404:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\MessagingRequestError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 406:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\MessagingRequestError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 415:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\MessagingRequestError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 429:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\MessagingRequestError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 500:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\MessagingRequestError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ }
+
+ throw $e;
+ }
+ }
+
+ /**
+ * Operation uploadMediaAsync
+ *
+ * Upload Media
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://messaging.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $media_id Media ID to retrieve. (required)
+ * @param \SplFileObject $body (required)
+ * @param string|null $content_type The media type of the entity-body. (optional)
+ * @param string|null $cache_control General-header field is used to specify directives that MUST be obeyed by all caching mechanisms along the request/response chain. (optional)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['uploadMedia'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function uploadMediaAsync(
+ string $account_id,
+ string $media_id,
+ \SplFileObject $body,
+ ?string $content_type = null,
+ ?string $cache_control = null,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['uploadMedia'][0]
+ ): PromiseInterface
+ {
+ return $this->uploadMediaAsyncWithHttpInfo($account_id, $media_id, $body, $content_type, $cache_control, $hostIndex, $variables, $contentType)
+ ->then(
+ function ($response) {
+ return $response[0];
+ }
+ );
+ }
+
+ /**
+ * Operation uploadMediaAsyncWithHttpInfo
+ *
+ * Upload Media
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://messaging.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $media_id Media ID to retrieve. (required)
+ * @param \SplFileObject $body (required)
+ * @param string|null $content_type The media type of the entity-body. (optional)
+ * @param string|null $cache_control General-header field is used to specify directives that MUST be obeyed by all caching mechanisms along the request/response chain. (optional)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['uploadMedia'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function uploadMediaAsyncWithHttpInfo(
+ string $account_id,
+ string $media_id,
+ \SplFileObject $body,
+ ?string $content_type = null,
+ ?string $cache_control = null,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['uploadMedia'][0]
+ ): PromiseInterface
+ {
+ $returnType = '';
+ $request = $this->uploadMediaRequest($account_id, $media_id, $body, $content_type, $cache_control, $hostIndex, $variables, $contentType);
+
+ return $this->client
+ ->sendAsync($request, $this->createHttpClientOption())
+ ->then(
+ function ($response) use ($returnType) {
+ return [null, $response->getStatusCode(), $response->getHeaders()];
+ },
+ function ($exception) {
+ $response = $exception->getResponse();
+ $statusCode = $response->getStatusCode();
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ $exception->getRequest()->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+ );
+ }
+
+ /**
+ * Create request for operation 'uploadMedia'
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://messaging.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $media_id Media ID to retrieve. (required)
+ * @param \SplFileObject $body (required)
+ * @param string|null $content_type The media type of the entity-body. (optional)
+ * @param string|null $cache_control General-header field is used to specify directives that MUST be obeyed by all caching mechanisms along the request/response chain. (optional)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['uploadMedia'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return \GuzzleHttp\Psr7\Request
+ */
+ public function uploadMediaRequest(
+ string $account_id,
+ string $media_id,
+ \SplFileObject $body,
+ ?string $content_type = null,
+ ?string $cache_control = null,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['uploadMedia'][0]
+ ): Request
+ {
+ // verify the required parameter 'account_id' is set
+ if ($account_id === null || (is_array($account_id) && count($account_id) === 0)) {
+ throw new InvalidArgumentException(
+ 'Missing the required parameter $account_id when calling uploadMedia'
+ );
+ }
+ // verify the required parameter 'media_id' is set
+ if ($media_id === null || (is_array($media_id) && count($media_id) === 0)) {
+ throw new InvalidArgumentException(
+ 'Missing the required parameter $media_id when calling uploadMedia'
+ );
+ }
+ // verify the required parameter 'body' is set
+ if ($body === null || (is_array($body) && count($body) === 0)) {
+ throw new InvalidArgumentException(
+ 'Missing the required parameter $body when calling uploadMedia'
+ );
+ }
+
+ $resourcePath = '/users/{accountId}/media/{mediaId}';
+ $formParams = [];
+ $queryParams = [];
+ $headerParams = [];
+ $httpBody = '';
+ $multipart = false;
+
+
+ // header params
+ if ($content_type !== null) {
+ $headerParams['Content-Type'] = ObjectSerializer::toHeaderValue($content_type);
+ }
+ // header params
+ if ($cache_control !== null) {
+ $headerParams['Cache-Control'] = ObjectSerializer::toHeaderValue($cache_control);
+ }
+
+ // path params
+ if ($account_id !== null) {
+ $resourcePath = str_replace(
+ '{accountId}',
+ ObjectSerializer::toPathValue($account_id),
+ $resourcePath
+ );
+ }
+ // path params
+ if ($media_id !== null) {
+ $resourcePath = str_replace(
+ '{mediaId}',
+ ObjectSerializer::toPathValue($media_id),
+ $resourcePath
+ );
+ }
+
+
+ $headers = $this->headerSelector->selectHeaders(
+ ['application/json', ],
+ $contentType,
+ $multipart
+ );
+
+ // for model (json/xml)
+ if (isset($body)) {
+ if (stripos($headers['Content-Type'], 'application/json') !== false) {
+ # if Content-Type contains "application/json", json_encode the body
+ $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($body));
+ } else {
+ $httpBody = $body;
+ }
+ } elseif (count($formParams) > 0) {
+ if ($multipart) {
+ $multipartContents = [];
+ foreach ($formParams as $formParamName => $formParamValue) {
+ $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
+ foreach ($formParamValueItems as $formParamValueItem) {
+ $multipartContents[] = [
+ 'name' => $formParamName,
+ 'contents' => $formParamValueItem
+ ];
+ }
+ }
+ // for HTTP post (form)
+ $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents);
+
+ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
+ # if Content-Type contains "application/json", json_encode the form parameters
+ $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams);
+ } else {
+ // for HTTP post (form)
+ $httpBody = ObjectSerializer::buildQuery($formParams);
+ }
+ }
+
+ // this endpoint requires HTTP basic authentication
+ if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) {
+ $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword());
+ }
+
+ // this endpoint requires OAuth (access token)
+ if (!empty($this->config->getAccessToken())) {
+ $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken();
+ }
+
+ $defaultHeaders = [];
+ if ($this->config->getUserAgent()) {
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
+ }
+
+ $headers = array_merge(
+ $defaultHeaders,
+ $headerParams,
+ $headers
+ );
+
+ if ($this->config->getIgnoreOperationHosts()) {
+ $operationHost = $this->config->getHost();
+ } else {
+ # Preserve the original behavior of server indexing.
+ if ($hostIndex === null) {
+ $hostIndex = $this->hostIndex;
+ }
+
+ $hostSettings = $this->getHostSettingsForuploadMedia();
+
+ if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) {
+ throw new InvalidArgumentException("Invalid index {$hostIndex} when selecting the host. Must be less than ".count($hostSettings));
+ }
+ $operationHost = Configuration::getHostString($hostSettings, $hostIndex, $variables);
+ }
+ $query = ObjectSerializer::buildQuery($queryParams);
+ return new Request(
+ 'PUT',
+ $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
+ $headers,
+ $httpBody
+ );
+ }
+
+ /**
+ * Returns an array of host settings for Operation uploadMedia
+ *
+ * @return array an array of host settings
+ */
+ protected function getHostSettingsForuploadMedia(): array
+ {
+ return [
+ [
+ "url" => "https://messaging.bandwidth.com/api/v2",
+ "description" => "Production",
+ ]
+ ];
+ }
+
+ /**
+ * Create http client option
+ *
+ * @throws \RuntimeException on file opening failure
+ * @return array of http client options
+ */
+ protected function createHttpClientOption(): array
+ {
+ $options = [];
+ if ($this->config->getDebug()) {
+ $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a');
+ if (!$options[RequestOptions::DEBUG]) {
+ throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile());
+ }
+ }
+
+ return $options;
+ }
+
+ private function handleResponseWithDataType(
+ string $dataType,
+ RequestInterface $request,
+ ResponseInterface $response,
+ ): array {
+ if (in_array($dataType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($dataType !== 'string') {
+ try {
+ $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR);
+ } catch (\JsonException $exception) {
+ throw new ApiException(
+ sprintf(
+ 'Error JSON decoding server response (%s)',
+ $request->getUri()
+ ),
+ $response->getStatusCode(),
+ $response->getHeaders(),
+ $content
+ );
+ }
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $dataType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ }
+
+ private function responseWithinRangeCode(
+ string $rangeCode,
+ int $statusCode,
+ ): bool {
+ $left = (int) ($rangeCode[0].'00');
+ $right = (int) ($rangeCode[0].'99');
+
+ return $statusCode >= $left && $statusCode <= $right;
+ }
+}
diff --git a/src/Api/MessagesApi.php b/src/Api/MessagesApi.php
new file mode 100644
index 0000000..bab49b3
--- /dev/null
+++ b/src/Api/MessagesApi.php
@@ -0,0 +1,1650 @@
+ $contentTypes **/
+ public const contentTypes = [
+ 'createMessage' => [
+ 'application/json',
+ ],
+ 'listMessages' => [
+ 'application/json',
+ ],
+ ];
+
+ /**
+ * @param ClientInterface|null $client
+ * @param Configuration|null $config
+ * @param HeaderSelector|null $selector
+ * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec
+ */
+ public function __construct(
+ ?ClientInterface $client = null,
+ ?Configuration $config = null,
+ ?HeaderSelector $selector = null,
+ int $hostIndex = 0
+ ) {
+ $this->client = $client ?: new Client();
+ $this->config = $config ?: Configuration::getDefaultConfiguration();
+ $this->headerSelector = $selector ?: new HeaderSelector();
+ $this->hostIndex = $hostIndex;
+ }
+
+ /**
+ * Set the host index
+ *
+ * @param int $hostIndex Host index (required)
+ */
+ public function setHostIndex(int $hostIndex): void
+ {
+ $this->hostIndex = $hostIndex;
+ }
+
+ /**
+ * Get the host index
+ *
+ * @return int Host index
+ */
+ public function getHostIndex(): int
+ {
+ return $this->hostIndex;
+ }
+
+ /**
+ * @return Configuration
+ */
+ public function getConfig(): Configuration
+ {
+ return $this->config;
+ }
+
+ /**
+ * Operation createMessage
+ *
+ * Create Message
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://messaging.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param \Bandwidth\Model\MessageRequest $message_request message_request (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createMessage'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return \Bandwidth\Model\Message|\Bandwidth\Model\CreateMessageRequestError|\Bandwidth\Model\MessagingRequestError
+ */
+ public function createMessage(
+ string $account_id,
+ \Bandwidth\Model\MessageRequest $message_request,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['createMessage'][0]
+ ): \Bandwidth\Model\Message|\Bandwidth\Model\CreateMessageRequestError|\Bandwidth\Model\MessagingRequestError
+ {
+ list($response) = $this->createMessageWithHttpInfo($account_id, $message_request, $hostIndex, $variables, $contentType);
+ return $response;
+ }
+
+ /**
+ * Operation createMessageWithHttpInfo
+ *
+ * Create Message
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://messaging.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param \Bandwidth\Model\MessageRequest $message_request (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createMessage'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return array{0: \Bandwidth\Model\Message|\Bandwidth\Model\CreateMessageRequestError|\Bandwidth\Model\MessagingRequestError, 1: int, 2: array} [response data, HTTP status code, HTTP response headers]
+ */
+ public function createMessageWithHttpInfo(
+ string $account_id,
+ \Bandwidth\Model\MessageRequest $message_request,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['createMessage'][0]
+ ): array
+ {
+ $request = $this->createMessageRequest($account_id, $message_request, $hostIndex, $variables, $contentType);
+
+ try {
+ $options = $this->createHttpClientOption();
+ try {
+ $response = $this->client->send($request, $options);
+ } catch (RequestException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
+ $e->getResponse() ? (string) $e->getResponse()->getBody() : null
+ );
+ } catch (ConnectException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ null,
+ null
+ );
+ }
+
+ $statusCode = $response->getStatusCode();
+
+ switch($statusCode) {
+ case 202:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\Message',
+ $request,
+ $response,
+ );
+ case 400:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\CreateMessageRequestError',
+ $request,
+ $response,
+ );
+ case 401:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\MessagingRequestError',
+ $request,
+ $response,
+ );
+ case 403:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\MessagingRequestError',
+ $request,
+ $response,
+ );
+ case 404:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\MessagingRequestError',
+ $request,
+ $response,
+ );
+ case 405:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\MessagingRequestError',
+ $request,
+ $response,
+ );
+ case 406:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\MessagingRequestError',
+ $request,
+ $response,
+ );
+ case 415:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\MessagingRequestError',
+ $request,
+ $response,
+ );
+ case 429:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\MessagingRequestError',
+ $request,
+ $response,
+ );
+ case 500:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\MessagingRequestError',
+ $request,
+ $response,
+ );
+ }
+
+ if ($statusCode < 200 || $statusCode > 299) {
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ (string) $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\Message',
+ $request,
+ $response,
+ );
+ } catch (ApiException $e) {
+ switch ($e->getCode()) {
+ case 202:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\Message',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 400:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\CreateMessageRequestError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 401:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\MessagingRequestError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 403:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\MessagingRequestError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 404:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\MessagingRequestError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 405:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\MessagingRequestError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 406:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\MessagingRequestError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 415:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\MessagingRequestError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 429:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\MessagingRequestError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 500:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\MessagingRequestError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ }
+
+ throw $e;
+ }
+ }
+
+ /**
+ * Operation createMessageAsync
+ *
+ * Create Message
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://messaging.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param \Bandwidth\Model\MessageRequest $message_request (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createMessage'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function createMessageAsync(
+ string $account_id,
+ \Bandwidth\Model\MessageRequest $message_request,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['createMessage'][0]
+ ): PromiseInterface
+ {
+ return $this->createMessageAsyncWithHttpInfo($account_id, $message_request, $hostIndex, $variables, $contentType)
+ ->then(
+ function ($response) {
+ return $response[0];
+ }
+ );
+ }
+
+ /**
+ * Operation createMessageAsyncWithHttpInfo
+ *
+ * Create Message
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://messaging.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param \Bandwidth\Model\MessageRequest $message_request (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createMessage'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function createMessageAsyncWithHttpInfo(
+ string $account_id,
+ \Bandwidth\Model\MessageRequest $message_request,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['createMessage'][0]
+ ): PromiseInterface
+ {
+ $returnType = '\Bandwidth\Model\Message';
+ $request = $this->createMessageRequest($account_id, $message_request, $hostIndex, $variables, $contentType);
+
+ return $this->client
+ ->sendAsync($request, $this->createHttpClientOption())
+ ->then(
+ function ($response) use ($returnType) {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ },
+ function ($exception) {
+ $response = $exception->getResponse();
+ $statusCode = $response->getStatusCode();
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ $exception->getRequest()->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+ );
+ }
+
+ /**
+ * Create request for operation 'createMessage'
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://messaging.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param \Bandwidth\Model\MessageRequest $message_request (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createMessage'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return \GuzzleHttp\Psr7\Request
+ */
+ public function createMessageRequest(
+ string $account_id,
+ \Bandwidth\Model\MessageRequest $message_request,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['createMessage'][0]
+ ): Request
+ {
+ // verify the required parameter 'account_id' is set
+ if ($account_id === null || (is_array($account_id) && count($account_id) === 0)) {
+ throw new InvalidArgumentException(
+ 'Missing the required parameter $account_id when calling createMessage'
+ );
+ }
+ // verify the required parameter 'message_request' is set
+ if ($message_request === null || (is_array($message_request) && count($message_request) === 0)) {
+ throw new InvalidArgumentException(
+ 'Missing the required parameter $message_request when calling createMessage'
+ );
+ }
+
+ $resourcePath = '/users/{accountId}/messages';
+ $formParams = [];
+ $queryParams = [];
+ $headerParams = [];
+ $httpBody = '';
+ $multipart = false;
+
+
+
+ // path params
+ if ($account_id !== null) {
+ $resourcePath = str_replace(
+ '{accountId}',
+ ObjectSerializer::toPathValue($account_id),
+ $resourcePath
+ );
+ }
+
+
+ $headers = $this->headerSelector->selectHeaders(
+ ['application/json', ],
+ $contentType,
+ $multipart
+ );
+
+ // for model (json/xml)
+ if (isset($message_request)) {
+ if (stripos($headers['Content-Type'], 'application/json') !== false) {
+ # if Content-Type contains "application/json", json_encode the body
+ $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($message_request));
+ } else {
+ $httpBody = $message_request;
+ }
+ } elseif (count($formParams) > 0) {
+ if ($multipart) {
+ $multipartContents = [];
+ foreach ($formParams as $formParamName => $formParamValue) {
+ $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
+ foreach ($formParamValueItems as $formParamValueItem) {
+ $multipartContents[] = [
+ 'name' => $formParamName,
+ 'contents' => $formParamValueItem
+ ];
+ }
+ }
+ // for HTTP post (form)
+ $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents);
+
+ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
+ # if Content-Type contains "application/json", json_encode the form parameters
+ $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams);
+ } else {
+ // for HTTP post (form)
+ $httpBody = ObjectSerializer::buildQuery($formParams);
+ }
+ }
+
+ // this endpoint requires HTTP basic authentication
+ if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) {
+ $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword());
+ }
+
+ // this endpoint requires OAuth (access token)
+ if (!empty($this->config->getAccessToken())) {
+ $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken();
+ }
+
+ $defaultHeaders = [];
+ if ($this->config->getUserAgent()) {
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
+ }
+
+ $headers = array_merge(
+ $defaultHeaders,
+ $headerParams,
+ $headers
+ );
+
+ if ($this->config->getIgnoreOperationHosts()) {
+ $operationHost = $this->config->getHost();
+ } else {
+ # Preserve the original behavior of server indexing.
+ if ($hostIndex === null) {
+ $hostIndex = $this->hostIndex;
+ }
+
+ $hostSettings = $this->getHostSettingsForcreateMessage();
+
+ if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) {
+ throw new InvalidArgumentException("Invalid index {$hostIndex} when selecting the host. Must be less than ".count($hostSettings));
+ }
+ $operationHost = Configuration::getHostString($hostSettings, $hostIndex, $variables);
+ }
+ $query = ObjectSerializer::buildQuery($queryParams);
+ return new Request(
+ 'POST',
+ $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
+ $headers,
+ $httpBody
+ );
+ }
+
+ /**
+ * Returns an array of host settings for Operation createMessage
+ *
+ * @return array an array of host settings
+ */
+ protected function getHostSettingsForcreateMessage(): array
+ {
+ return [
+ [
+ "url" => "https://messaging.bandwidth.com/api/v2",
+ "description" => "Production",
+ ]
+ ];
+ }
+
+ /**
+ * Operation listMessages
+ *
+ * List Messages
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://messaging.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string|null $message_id The ID of the message to search for. Special characters need to be encoded using URL encoding. Message IDs could come in different formats, e.g., 9e0df4ca-b18d-40d7-a59f-82fcdf5ae8e6 and 1589228074636lm4k2je7j7jklbn2 are valid message ID formats. Note that you must include at least one query parameter. (optional)
+ * @param string|null $source_tn The phone number that sent the message. Accepted values are: a single full phone number a comma separated list of full phone numbers (maximum of 10) or a single partial phone number (minimum of 5 characters e.g. '%2B1919'). (optional)
+ * @param string|null $destination_tn The phone number that received the message. Accepted values are: a single full phone number a comma separated list of full phone numbers (maximum of 10) or a single partial phone number (minimum of 5 characters e.g. '%2B1919'). (optional)
+ * @param \Bandwidth\Model\MessageStatusEnum|null $message_status The status of the message. One of RECEIVED QUEUED SENDING SENT FAILED DELIVERED ACCEPTED UNDELIVERED. (optional)
+ * @param \Bandwidth\Model\ListMessageDirectionEnum|null $message_direction The direction of the message. One of INBOUND OUTBOUND. (optional)
+ * @param string|null $carrier_name The name of the carrier used for this message. Possible values include but are not limited to Verizon and TMobile. Special characters need to be encoded using URL encoding (i.e. AT&T should be passed as AT%26T). (optional)
+ * @param \Bandwidth\Model\MessageTypeEnum|null $message_type The type of message. Either sms or mms. (optional)
+ * @param int|null $error_code The error code of the message. (optional)
+ * @param string|null $from_date_time The start of the date range to search in ISO 8601 format. Uses the message receive time. The date range to search in is currently 14 days. (optional)
+ * @param string|null $to_date_time The end of the date range to search in ISO 8601 format. Uses the message receive time. The date range to search in is currently 14 days. (optional)
+ * @param string|null $campaign_id The campaign ID of the message. (optional)
+ * @param int|null $from_bw_latency The minimum Bandwidth latency of the message in seconds. Only available for accounts with the Advanced Quality Metrics feature enabled. (optional)
+ * @param bool|null $bw_queued A boolean value indicating whether the message is queued in the Bandwidth network. (optional)
+ * @param \Bandwidth\Model\ProductTypeEnum|null $product Messaging product associated with the message. (optional)
+ * @param string|null $location Location Id associated with the message. (optional)
+ * @param bool|null $carrier_queued A boolean value indicating whether the message is queued in the carrier network. Only available for OUTBOUND messages from accounts with the Advanced Quality Metrics feature enabled. (optional)
+ * @param int|null $from_carrier_latency The minimum carrier latency of the message in seconds. Only available for OUTBOUND messages from accounts with the Advanced Quality Metrics feature enabled. (optional)
+ * @param string|null $calling_number_country_a3 Calling number country in A3 format. (optional)
+ * @param string|null $called_number_country_a3 Called number country in A3 format. (optional)
+ * @param int|null $from_segment_count Segment count (start range). (optional)
+ * @param int|null $to_segment_count Segment count (end range). (optional)
+ * @param int|null $from_message_size Message size (start range). (optional)
+ * @param int|null $to_message_size Message size (end range). (optional)
+ * @param string|null $sort The field and direction to sort by combined with a colon. Direction is either asc or desc. (optional)
+ * @param string|null $page_token A base64 encoded value used for pagination of results. (optional)
+ * @param int|null $limit The maximum records requested in search result. Default 100. The sum of limit and after cannot be more than 10000. (optional)
+ * @param bool|null $limit_total_count When set to true, the response's totalCount field will have a maximum value of 10,000. When set to false, or excluded, this will give an accurate totalCount of all messages that match the provided filters. If you are experiencing latency, try using this parameter to limit your results. (optional)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listMessages'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return \Bandwidth\Model\MessagesList|\Bandwidth\Model\MessagingRequestError
+ */
+ public function listMessages(
+ string $account_id,
+ ?string $message_id = null,
+ ?string $source_tn = null,
+ ?string $destination_tn = null,
+ ?\Bandwidth\Model\MessageStatusEnum $message_status = null,
+ ?\Bandwidth\Model\ListMessageDirectionEnum $message_direction = null,
+ ?string $carrier_name = null,
+ ?\Bandwidth\Model\MessageTypeEnum $message_type = null,
+ ?int $error_code = null,
+ ?string $from_date_time = null,
+ ?string $to_date_time = null,
+ ?string $campaign_id = null,
+ ?int $from_bw_latency = null,
+ ?bool $bw_queued = null,
+ ?\Bandwidth\Model\ProductTypeEnum $product = null,
+ ?string $location = null,
+ ?bool $carrier_queued = null,
+ ?int $from_carrier_latency = null,
+ ?string $calling_number_country_a3 = null,
+ ?string $called_number_country_a3 = null,
+ ?int $from_segment_count = null,
+ ?int $to_segment_count = null,
+ ?int $from_message_size = null,
+ ?int $to_message_size = null,
+ ?string $sort = null,
+ ?string $page_token = null,
+ ?int $limit = null,
+ ?bool $limit_total_count = null,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['listMessages'][0]
+ ): \Bandwidth\Model\MessagesList|\Bandwidth\Model\MessagingRequestError
+ {
+ list($response) = $this->listMessagesWithHttpInfo($account_id, $message_id, $source_tn, $destination_tn, $message_status, $message_direction, $carrier_name, $message_type, $error_code, $from_date_time, $to_date_time, $campaign_id, $from_bw_latency, $bw_queued, $product, $location, $carrier_queued, $from_carrier_latency, $calling_number_country_a3, $called_number_country_a3, $from_segment_count, $to_segment_count, $from_message_size, $to_message_size, $sort, $page_token, $limit, $limit_total_count, $hostIndex, $variables, $contentType);
+ return $response;
+ }
+
+ /**
+ * Operation listMessagesWithHttpInfo
+ *
+ * List Messages
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://messaging.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string|null $message_id The ID of the message to search for. Special characters need to be encoded using URL encoding. Message IDs could come in different formats, e.g., 9e0df4ca-b18d-40d7-a59f-82fcdf5ae8e6 and 1589228074636lm4k2je7j7jklbn2 are valid message ID formats. Note that you must include at least one query parameter. (optional)
+ * @param string|null $source_tn The phone number that sent the message. Accepted values are: a single full phone number a comma separated list of full phone numbers (maximum of 10) or a single partial phone number (minimum of 5 characters e.g. '%2B1919'). (optional)
+ * @param string|null $destination_tn The phone number that received the message. Accepted values are: a single full phone number a comma separated list of full phone numbers (maximum of 10) or a single partial phone number (minimum of 5 characters e.g. '%2B1919'). (optional)
+ * @param \Bandwidth\Model\MessageStatusEnum|null $message_status The status of the message. One of RECEIVED QUEUED SENDING SENT FAILED DELIVERED ACCEPTED UNDELIVERED. (optional)
+ * @param \Bandwidth\Model\ListMessageDirectionEnum|null $message_direction The direction of the message. One of INBOUND OUTBOUND. (optional)
+ * @param string|null $carrier_name The name of the carrier used for this message. Possible values include but are not limited to Verizon and TMobile. Special characters need to be encoded using URL encoding (i.e. AT&T should be passed as AT%26T). (optional)
+ * @param \Bandwidth\Model\MessageTypeEnum|null $message_type The type of message. Either sms or mms. (optional)
+ * @param int|null $error_code The error code of the message. (optional)
+ * @param string|null $from_date_time The start of the date range to search in ISO 8601 format. Uses the message receive time. The date range to search in is currently 14 days. (optional)
+ * @param string|null $to_date_time The end of the date range to search in ISO 8601 format. Uses the message receive time. The date range to search in is currently 14 days. (optional)
+ * @param string|null $campaign_id The campaign ID of the message. (optional)
+ * @param int|null $from_bw_latency The minimum Bandwidth latency of the message in seconds. Only available for accounts with the Advanced Quality Metrics feature enabled. (optional)
+ * @param bool|null $bw_queued A boolean value indicating whether the message is queued in the Bandwidth network. (optional)
+ * @param \Bandwidth\Model\ProductTypeEnum|null $product Messaging product associated with the message. (optional)
+ * @param string|null $location Location Id associated with the message. (optional)
+ * @param bool|null $carrier_queued A boolean value indicating whether the message is queued in the carrier network. Only available for OUTBOUND messages from accounts with the Advanced Quality Metrics feature enabled. (optional)
+ * @param int|null $from_carrier_latency The minimum carrier latency of the message in seconds. Only available for OUTBOUND messages from accounts with the Advanced Quality Metrics feature enabled. (optional)
+ * @param string|null $calling_number_country_a3 Calling number country in A3 format. (optional)
+ * @param string|null $called_number_country_a3 Called number country in A3 format. (optional)
+ * @param int|null $from_segment_count Segment count (start range). (optional)
+ * @param int|null $to_segment_count Segment count (end range). (optional)
+ * @param int|null $from_message_size Message size (start range). (optional)
+ * @param int|null $to_message_size Message size (end range). (optional)
+ * @param string|null $sort The field and direction to sort by combined with a colon. Direction is either asc or desc. (optional)
+ * @param string|null $page_token A base64 encoded value used for pagination of results. (optional)
+ * @param int|null $limit The maximum records requested in search result. Default 100. The sum of limit and after cannot be more than 10000. (optional)
+ * @param bool|null $limit_total_count When set to true, the response's totalCount field will have a maximum value of 10,000. When set to false, or excluded, this will give an accurate totalCount of all messages that match the provided filters. If you are experiencing latency, try using this parameter to limit your results. (optional)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listMessages'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return array{0: \Bandwidth\Model\MessagesList|\Bandwidth\Model\MessagingRequestError, 1: int, 2: array} [response data, HTTP status code, HTTP response headers]
+ */
+ public function listMessagesWithHttpInfo(
+ string $account_id,
+ ?string $message_id = null,
+ ?string $source_tn = null,
+ ?string $destination_tn = null,
+ ?\Bandwidth\Model\MessageStatusEnum $message_status = null,
+ ?\Bandwidth\Model\ListMessageDirectionEnum $message_direction = null,
+ ?string $carrier_name = null,
+ ?\Bandwidth\Model\MessageTypeEnum $message_type = null,
+ ?int $error_code = null,
+ ?string $from_date_time = null,
+ ?string $to_date_time = null,
+ ?string $campaign_id = null,
+ ?int $from_bw_latency = null,
+ ?bool $bw_queued = null,
+ ?\Bandwidth\Model\ProductTypeEnum $product = null,
+ ?string $location = null,
+ ?bool $carrier_queued = null,
+ ?int $from_carrier_latency = null,
+ ?string $calling_number_country_a3 = null,
+ ?string $called_number_country_a3 = null,
+ ?int $from_segment_count = null,
+ ?int $to_segment_count = null,
+ ?int $from_message_size = null,
+ ?int $to_message_size = null,
+ ?string $sort = null,
+ ?string $page_token = null,
+ ?int $limit = null,
+ ?bool $limit_total_count = null,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['listMessages'][0]
+ ): array
+ {
+ $request = $this->listMessagesRequest($account_id, $message_id, $source_tn, $destination_tn, $message_status, $message_direction, $carrier_name, $message_type, $error_code, $from_date_time, $to_date_time, $campaign_id, $from_bw_latency, $bw_queued, $product, $location, $carrier_queued, $from_carrier_latency, $calling_number_country_a3, $called_number_country_a3, $from_segment_count, $to_segment_count, $from_message_size, $to_message_size, $sort, $page_token, $limit, $limit_total_count, $hostIndex, $variables, $contentType);
+
+ try {
+ $options = $this->createHttpClientOption();
+ try {
+ $response = $this->client->send($request, $options);
+ } catch (RequestException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
+ $e->getResponse() ? (string) $e->getResponse()->getBody() : null
+ );
+ } catch (ConnectException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ null,
+ null
+ );
+ }
+
+ $statusCode = $response->getStatusCode();
+
+ switch($statusCode) {
+ case 200:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\MessagesList',
+ $request,
+ $response,
+ );
+ case 400:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\MessagingRequestError',
+ $request,
+ $response,
+ );
+ case 401:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\MessagingRequestError',
+ $request,
+ $response,
+ );
+ case 403:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\MessagingRequestError',
+ $request,
+ $response,
+ );
+ case 404:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\MessagingRequestError',
+ $request,
+ $response,
+ );
+ case 405:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\MessagingRequestError',
+ $request,
+ $response,
+ );
+ case 415:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\MessagingRequestError',
+ $request,
+ $response,
+ );
+ case 429:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\MessagingRequestError',
+ $request,
+ $response,
+ );
+ case 500:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\MessagingRequestError',
+ $request,
+ $response,
+ );
+ }
+
+ if ($statusCode < 200 || $statusCode > 299) {
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ (string) $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\MessagesList',
+ $request,
+ $response,
+ );
+ } catch (ApiException $e) {
+ switch ($e->getCode()) {
+ case 200:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\MessagesList',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 400:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\MessagingRequestError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 401:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\MessagingRequestError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 403:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\MessagingRequestError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 404:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\MessagingRequestError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 405:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\MessagingRequestError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 415:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\MessagingRequestError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 429:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\MessagingRequestError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 500:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\MessagingRequestError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ }
+
+ throw $e;
+ }
+ }
+
+ /**
+ * Operation listMessagesAsync
+ *
+ * List Messages
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://messaging.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string|null $message_id The ID of the message to search for. Special characters need to be encoded using URL encoding. Message IDs could come in different formats, e.g., 9e0df4ca-b18d-40d7-a59f-82fcdf5ae8e6 and 1589228074636lm4k2je7j7jklbn2 are valid message ID formats. Note that you must include at least one query parameter. (optional)
+ * @param string|null $source_tn The phone number that sent the message. Accepted values are: a single full phone number a comma separated list of full phone numbers (maximum of 10) or a single partial phone number (minimum of 5 characters e.g. '%2B1919'). (optional)
+ * @param string|null $destination_tn The phone number that received the message. Accepted values are: a single full phone number a comma separated list of full phone numbers (maximum of 10) or a single partial phone number (minimum of 5 characters e.g. '%2B1919'). (optional)
+ * @param \Bandwidth\Model\MessageStatusEnum|null $message_status The status of the message. One of RECEIVED QUEUED SENDING SENT FAILED DELIVERED ACCEPTED UNDELIVERED. (optional)
+ * @param \Bandwidth\Model\ListMessageDirectionEnum|null $message_direction The direction of the message. One of INBOUND OUTBOUND. (optional)
+ * @param string|null $carrier_name The name of the carrier used for this message. Possible values include but are not limited to Verizon and TMobile. Special characters need to be encoded using URL encoding (i.e. AT&T should be passed as AT%26T). (optional)
+ * @param \Bandwidth\Model\MessageTypeEnum|null $message_type The type of message. Either sms or mms. (optional)
+ * @param int|null $error_code The error code of the message. (optional)
+ * @param string|null $from_date_time The start of the date range to search in ISO 8601 format. Uses the message receive time. The date range to search in is currently 14 days. (optional)
+ * @param string|null $to_date_time The end of the date range to search in ISO 8601 format. Uses the message receive time. The date range to search in is currently 14 days. (optional)
+ * @param string|null $campaign_id The campaign ID of the message. (optional)
+ * @param int|null $from_bw_latency The minimum Bandwidth latency of the message in seconds. Only available for accounts with the Advanced Quality Metrics feature enabled. (optional)
+ * @param bool|null $bw_queued A boolean value indicating whether the message is queued in the Bandwidth network. (optional)
+ * @param \Bandwidth\Model\ProductTypeEnum|null $product Messaging product associated with the message. (optional)
+ * @param string|null $location Location Id associated with the message. (optional)
+ * @param bool|null $carrier_queued A boolean value indicating whether the message is queued in the carrier network. Only available for OUTBOUND messages from accounts with the Advanced Quality Metrics feature enabled. (optional)
+ * @param int|null $from_carrier_latency The minimum carrier latency of the message in seconds. Only available for OUTBOUND messages from accounts with the Advanced Quality Metrics feature enabled. (optional)
+ * @param string|null $calling_number_country_a3 Calling number country in A3 format. (optional)
+ * @param string|null $called_number_country_a3 Called number country in A3 format. (optional)
+ * @param int|null $from_segment_count Segment count (start range). (optional)
+ * @param int|null $to_segment_count Segment count (end range). (optional)
+ * @param int|null $from_message_size Message size (start range). (optional)
+ * @param int|null $to_message_size Message size (end range). (optional)
+ * @param string|null $sort The field and direction to sort by combined with a colon. Direction is either asc or desc. (optional)
+ * @param string|null $page_token A base64 encoded value used for pagination of results. (optional)
+ * @param int|null $limit The maximum records requested in search result. Default 100. The sum of limit and after cannot be more than 10000. (optional)
+ * @param bool|null $limit_total_count When set to true, the response's totalCount field will have a maximum value of 10,000. When set to false, or excluded, this will give an accurate totalCount of all messages that match the provided filters. If you are experiencing latency, try using this parameter to limit your results. (optional)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listMessages'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function listMessagesAsync(
+ string $account_id,
+ ?string $message_id = null,
+ ?string $source_tn = null,
+ ?string $destination_tn = null,
+ ?\Bandwidth\Model\MessageStatusEnum $message_status = null,
+ ?\Bandwidth\Model\ListMessageDirectionEnum $message_direction = null,
+ ?string $carrier_name = null,
+ ?\Bandwidth\Model\MessageTypeEnum $message_type = null,
+ ?int $error_code = null,
+ ?string $from_date_time = null,
+ ?string $to_date_time = null,
+ ?string $campaign_id = null,
+ ?int $from_bw_latency = null,
+ ?bool $bw_queued = null,
+ ?\Bandwidth\Model\ProductTypeEnum $product = null,
+ ?string $location = null,
+ ?bool $carrier_queued = null,
+ ?int $from_carrier_latency = null,
+ ?string $calling_number_country_a3 = null,
+ ?string $called_number_country_a3 = null,
+ ?int $from_segment_count = null,
+ ?int $to_segment_count = null,
+ ?int $from_message_size = null,
+ ?int $to_message_size = null,
+ ?string $sort = null,
+ ?string $page_token = null,
+ ?int $limit = null,
+ ?bool $limit_total_count = null,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['listMessages'][0]
+ ): PromiseInterface
+ {
+ return $this->listMessagesAsyncWithHttpInfo($account_id, $message_id, $source_tn, $destination_tn, $message_status, $message_direction, $carrier_name, $message_type, $error_code, $from_date_time, $to_date_time, $campaign_id, $from_bw_latency, $bw_queued, $product, $location, $carrier_queued, $from_carrier_latency, $calling_number_country_a3, $called_number_country_a3, $from_segment_count, $to_segment_count, $from_message_size, $to_message_size, $sort, $page_token, $limit, $limit_total_count, $hostIndex, $variables, $contentType)
+ ->then(
+ function ($response) {
+ return $response[0];
+ }
+ );
+ }
+
+ /**
+ * Operation listMessagesAsyncWithHttpInfo
+ *
+ * List Messages
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://messaging.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string|null $message_id The ID of the message to search for. Special characters need to be encoded using URL encoding. Message IDs could come in different formats, e.g., 9e0df4ca-b18d-40d7-a59f-82fcdf5ae8e6 and 1589228074636lm4k2je7j7jklbn2 are valid message ID formats. Note that you must include at least one query parameter. (optional)
+ * @param string|null $source_tn The phone number that sent the message. Accepted values are: a single full phone number a comma separated list of full phone numbers (maximum of 10) or a single partial phone number (minimum of 5 characters e.g. '%2B1919'). (optional)
+ * @param string|null $destination_tn The phone number that received the message. Accepted values are: a single full phone number a comma separated list of full phone numbers (maximum of 10) or a single partial phone number (minimum of 5 characters e.g. '%2B1919'). (optional)
+ * @param \Bandwidth\Model\MessageStatusEnum|null $message_status The status of the message. One of RECEIVED QUEUED SENDING SENT FAILED DELIVERED ACCEPTED UNDELIVERED. (optional)
+ * @param \Bandwidth\Model\ListMessageDirectionEnum|null $message_direction The direction of the message. One of INBOUND OUTBOUND. (optional)
+ * @param string|null $carrier_name The name of the carrier used for this message. Possible values include but are not limited to Verizon and TMobile. Special characters need to be encoded using URL encoding (i.e. AT&T should be passed as AT%26T). (optional)
+ * @param \Bandwidth\Model\MessageTypeEnum|null $message_type The type of message. Either sms or mms. (optional)
+ * @param int|null $error_code The error code of the message. (optional)
+ * @param string|null $from_date_time The start of the date range to search in ISO 8601 format. Uses the message receive time. The date range to search in is currently 14 days. (optional)
+ * @param string|null $to_date_time The end of the date range to search in ISO 8601 format. Uses the message receive time. The date range to search in is currently 14 days. (optional)
+ * @param string|null $campaign_id The campaign ID of the message. (optional)
+ * @param int|null $from_bw_latency The minimum Bandwidth latency of the message in seconds. Only available for accounts with the Advanced Quality Metrics feature enabled. (optional)
+ * @param bool|null $bw_queued A boolean value indicating whether the message is queued in the Bandwidth network. (optional)
+ * @param \Bandwidth\Model\ProductTypeEnum|null $product Messaging product associated with the message. (optional)
+ * @param string|null $location Location Id associated with the message. (optional)
+ * @param bool|null $carrier_queued A boolean value indicating whether the message is queued in the carrier network. Only available for OUTBOUND messages from accounts with the Advanced Quality Metrics feature enabled. (optional)
+ * @param int|null $from_carrier_latency The minimum carrier latency of the message in seconds. Only available for OUTBOUND messages from accounts with the Advanced Quality Metrics feature enabled. (optional)
+ * @param string|null $calling_number_country_a3 Calling number country in A3 format. (optional)
+ * @param string|null $called_number_country_a3 Called number country in A3 format. (optional)
+ * @param int|null $from_segment_count Segment count (start range). (optional)
+ * @param int|null $to_segment_count Segment count (end range). (optional)
+ * @param int|null $from_message_size Message size (start range). (optional)
+ * @param int|null $to_message_size Message size (end range). (optional)
+ * @param string|null $sort The field and direction to sort by combined with a colon. Direction is either asc or desc. (optional)
+ * @param string|null $page_token A base64 encoded value used for pagination of results. (optional)
+ * @param int|null $limit The maximum records requested in search result. Default 100. The sum of limit and after cannot be more than 10000. (optional)
+ * @param bool|null $limit_total_count When set to true, the response's totalCount field will have a maximum value of 10,000. When set to false, or excluded, this will give an accurate totalCount of all messages that match the provided filters. If you are experiencing latency, try using this parameter to limit your results. (optional)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listMessages'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function listMessagesAsyncWithHttpInfo(
+ string $account_id,
+ ?string $message_id = null,
+ ?string $source_tn = null,
+ ?string $destination_tn = null,
+ ?\Bandwidth\Model\MessageStatusEnum $message_status = null,
+ ?\Bandwidth\Model\ListMessageDirectionEnum $message_direction = null,
+ ?string $carrier_name = null,
+ ?\Bandwidth\Model\MessageTypeEnum $message_type = null,
+ ?int $error_code = null,
+ ?string $from_date_time = null,
+ ?string $to_date_time = null,
+ ?string $campaign_id = null,
+ ?int $from_bw_latency = null,
+ ?bool $bw_queued = null,
+ ?\Bandwidth\Model\ProductTypeEnum $product = null,
+ ?string $location = null,
+ ?bool $carrier_queued = null,
+ ?int $from_carrier_latency = null,
+ ?string $calling_number_country_a3 = null,
+ ?string $called_number_country_a3 = null,
+ ?int $from_segment_count = null,
+ ?int $to_segment_count = null,
+ ?int $from_message_size = null,
+ ?int $to_message_size = null,
+ ?string $sort = null,
+ ?string $page_token = null,
+ ?int $limit = null,
+ ?bool $limit_total_count = null,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['listMessages'][0]
+ ): PromiseInterface
+ {
+ $returnType = '\Bandwidth\Model\MessagesList';
+ $request = $this->listMessagesRequest($account_id, $message_id, $source_tn, $destination_tn, $message_status, $message_direction, $carrier_name, $message_type, $error_code, $from_date_time, $to_date_time, $campaign_id, $from_bw_latency, $bw_queued, $product, $location, $carrier_queued, $from_carrier_latency, $calling_number_country_a3, $called_number_country_a3, $from_segment_count, $to_segment_count, $from_message_size, $to_message_size, $sort, $page_token, $limit, $limit_total_count, $hostIndex, $variables, $contentType);
+
+ return $this->client
+ ->sendAsync($request, $this->createHttpClientOption())
+ ->then(
+ function ($response) use ($returnType) {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ },
+ function ($exception) {
+ $response = $exception->getResponse();
+ $statusCode = $response->getStatusCode();
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ $exception->getRequest()->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+ );
+ }
+
+ /**
+ * Create request for operation 'listMessages'
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://messaging.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string|null $message_id The ID of the message to search for. Special characters need to be encoded using URL encoding. Message IDs could come in different formats, e.g., 9e0df4ca-b18d-40d7-a59f-82fcdf5ae8e6 and 1589228074636lm4k2je7j7jklbn2 are valid message ID formats. Note that you must include at least one query parameter. (optional)
+ * @param string|null $source_tn The phone number that sent the message. Accepted values are: a single full phone number a comma separated list of full phone numbers (maximum of 10) or a single partial phone number (minimum of 5 characters e.g. '%2B1919'). (optional)
+ * @param string|null $destination_tn The phone number that received the message. Accepted values are: a single full phone number a comma separated list of full phone numbers (maximum of 10) or a single partial phone number (minimum of 5 characters e.g. '%2B1919'). (optional)
+ * @param \Bandwidth\Model\MessageStatusEnum|null $message_status The status of the message. One of RECEIVED QUEUED SENDING SENT FAILED DELIVERED ACCEPTED UNDELIVERED. (optional)
+ * @param \Bandwidth\Model\ListMessageDirectionEnum|null $message_direction The direction of the message. One of INBOUND OUTBOUND. (optional)
+ * @param string|null $carrier_name The name of the carrier used for this message. Possible values include but are not limited to Verizon and TMobile. Special characters need to be encoded using URL encoding (i.e. AT&T should be passed as AT%26T). (optional)
+ * @param \Bandwidth\Model\MessageTypeEnum|null $message_type The type of message. Either sms or mms. (optional)
+ * @param int|null $error_code The error code of the message. (optional)
+ * @param string|null $from_date_time The start of the date range to search in ISO 8601 format. Uses the message receive time. The date range to search in is currently 14 days. (optional)
+ * @param string|null $to_date_time The end of the date range to search in ISO 8601 format. Uses the message receive time. The date range to search in is currently 14 days. (optional)
+ * @param string|null $campaign_id The campaign ID of the message. (optional)
+ * @param int|null $from_bw_latency The minimum Bandwidth latency of the message in seconds. Only available for accounts with the Advanced Quality Metrics feature enabled. (optional)
+ * @param bool|null $bw_queued A boolean value indicating whether the message is queued in the Bandwidth network. (optional)
+ * @param \Bandwidth\Model\ProductTypeEnum|null $product Messaging product associated with the message. (optional)
+ * @param string|null $location Location Id associated with the message. (optional)
+ * @param bool|null $carrier_queued A boolean value indicating whether the message is queued in the carrier network. Only available for OUTBOUND messages from accounts with the Advanced Quality Metrics feature enabled. (optional)
+ * @param int|null $from_carrier_latency The minimum carrier latency of the message in seconds. Only available for OUTBOUND messages from accounts with the Advanced Quality Metrics feature enabled. (optional)
+ * @param string|null $calling_number_country_a3 Calling number country in A3 format. (optional)
+ * @param string|null $called_number_country_a3 Called number country in A3 format. (optional)
+ * @param int|null $from_segment_count Segment count (start range). (optional)
+ * @param int|null $to_segment_count Segment count (end range). (optional)
+ * @param int|null $from_message_size Message size (start range). (optional)
+ * @param int|null $to_message_size Message size (end range). (optional)
+ * @param string|null $sort The field and direction to sort by combined with a colon. Direction is either asc or desc. (optional)
+ * @param string|null $page_token A base64 encoded value used for pagination of results. (optional)
+ * @param int|null $limit The maximum records requested in search result. Default 100. The sum of limit and after cannot be more than 10000. (optional)
+ * @param bool|null $limit_total_count When set to true, the response's totalCount field will have a maximum value of 10,000. When set to false, or excluded, this will give an accurate totalCount of all messages that match the provided filters. If you are experiencing latency, try using this parameter to limit your results. (optional)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listMessages'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return \GuzzleHttp\Psr7\Request
+ */
+ public function listMessagesRequest(
+ string $account_id,
+ ?string $message_id = null,
+ ?string $source_tn = null,
+ ?string $destination_tn = null,
+ ?\Bandwidth\Model\MessageStatusEnum $message_status = null,
+ ?\Bandwidth\Model\ListMessageDirectionEnum $message_direction = null,
+ ?string $carrier_name = null,
+ ?\Bandwidth\Model\MessageTypeEnum $message_type = null,
+ ?int $error_code = null,
+ ?string $from_date_time = null,
+ ?string $to_date_time = null,
+ ?string $campaign_id = null,
+ ?int $from_bw_latency = null,
+ ?bool $bw_queued = null,
+ ?\Bandwidth\Model\ProductTypeEnum $product = null,
+ ?string $location = null,
+ ?bool $carrier_queued = null,
+ ?int $from_carrier_latency = null,
+ ?string $calling_number_country_a3 = null,
+ ?string $called_number_country_a3 = null,
+ ?int $from_segment_count = null,
+ ?int $to_segment_count = null,
+ ?int $from_message_size = null,
+ ?int $to_message_size = null,
+ ?string $sort = null,
+ ?string $page_token = null,
+ ?int $limit = null,
+ ?bool $limit_total_count = null,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['listMessages'][0]
+ ): Request
+ {
+ // verify the required parameter 'account_id' is set
+ if ($account_id === null || (is_array($account_id) && count($account_id) === 0)) {
+ throw new InvalidArgumentException(
+ 'Missing the required parameter $account_id when calling listMessages'
+ );
+ }
+
+ $resourcePath = '/users/{accountId}/messages';
+ $queryParams = [];
+ $headerParams = [];
+ $httpBody = '';
+ $multipart = false;
+
+ // query params
+ $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+ $message_id,
+ 'messageId', // param base name
+ 'string', // openApiType
+ 'form', // style
+ true, // explode
+ false // required
+ ) ?? []);
+ // query params
+ $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+ $source_tn,
+ 'sourceTn', // param base name
+ 'string', // openApiType
+ 'form', // style
+ true, // explode
+ false // required
+ ) ?? []);
+ // query params
+ $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+ $destination_tn,
+ 'destinationTn', // param base name
+ 'string', // openApiType
+ 'form', // style
+ true, // explode
+ false // required
+ ) ?? []);
+ // query params
+ $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+ $message_status?->value,
+ 'messageStatus', // param base name
+ 'MessageStatusEnum', // openApiType
+ 'form', // style
+ true, // explode
+ false // required
+ ) ?? []);
+ // query params
+ $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+ $message_direction?->value,
+ 'messageDirection', // param base name
+ 'ListMessageDirectionEnum', // openApiType
+ 'form', // style
+ true, // explode
+ false // required
+ ) ?? []);
+ // query params
+ $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+ $carrier_name,
+ 'carrierName', // param base name
+ 'string', // openApiType
+ 'form', // style
+ true, // explode
+ false // required
+ ) ?? []);
+ // query params
+ $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+ $message_type?->value,
+ 'messageType', // param base name
+ 'MessageTypeEnum', // openApiType
+ 'form', // style
+ true, // explode
+ false // required
+ ) ?? []);
+ // query params
+ $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+ $error_code,
+ 'errorCode', // param base name
+ 'integer', // openApiType
+ 'form', // style
+ true, // explode
+ false // required
+ ) ?? []);
+ // query params
+ $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+ $from_date_time,
+ 'fromDateTime', // param base name
+ 'string', // openApiType
+ 'form', // style
+ true, // explode
+ false // required
+ ) ?? []);
+ // query params
+ $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+ $to_date_time,
+ 'toDateTime', // param base name
+ 'string', // openApiType
+ 'form', // style
+ true, // explode
+ false // required
+ ) ?? []);
+ // query params
+ $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+ $campaign_id,
+ 'campaignId', // param base name
+ 'string', // openApiType
+ 'form', // style
+ true, // explode
+ false // required
+ ) ?? []);
+ // query params
+ $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+ $from_bw_latency,
+ 'fromBwLatency', // param base name
+ 'integer', // openApiType
+ 'form', // style
+ true, // explode
+ false // required
+ ) ?? []);
+ // query params
+ $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+ $bw_queued,
+ 'bwQueued', // param base name
+ 'boolean', // openApiType
+ 'form', // style
+ true, // explode
+ false // required
+ ) ?? []);
+ // query params
+ $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+ $product?->value,
+ 'product', // param base name
+ 'ProductTypeEnum', // openApiType
+ 'form', // style
+ true, // explode
+ false // required
+ ) ?? []);
+ // query params
+ $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+ $location,
+ 'location', // param base name
+ 'string', // openApiType
+ 'form', // style
+ true, // explode
+ false // required
+ ) ?? []);
+ // query params
+ $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+ $carrier_queued,
+ 'carrierQueued', // param base name
+ 'boolean', // openApiType
+ 'form', // style
+ true, // explode
+ false // required
+ ) ?? []);
+ // query params
+ $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+ $from_carrier_latency,
+ 'fromCarrierLatency', // param base name
+ 'integer', // openApiType
+ 'form', // style
+ true, // explode
+ false // required
+ ) ?? []);
+ // query params
+ $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+ $calling_number_country_a3,
+ 'callingNumberCountryA3', // param base name
+ 'string', // openApiType
+ 'form', // style
+ true, // explode
+ false // required
+ ) ?? []);
+ // query params
+ $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+ $called_number_country_a3,
+ 'calledNumberCountryA3', // param base name
+ 'string', // openApiType
+ 'form', // style
+ true, // explode
+ false // required
+ ) ?? []);
+ // query params
+ $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+ $from_segment_count,
+ 'fromSegmentCount', // param base name
+ 'integer', // openApiType
+ 'form', // style
+ true, // explode
+ false // required
+ ) ?? []);
+ // query params
+ $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+ $to_segment_count,
+ 'toSegmentCount', // param base name
+ 'integer', // openApiType
+ 'form', // style
+ true, // explode
+ false // required
+ ) ?? []);
+ // query params
+ $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+ $from_message_size,
+ 'fromMessageSize', // param base name
+ 'integer', // openApiType
+ 'form', // style
+ true, // explode
+ false // required
+ ) ?? []);
+ // query params
+ $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+ $to_message_size,
+ 'toMessageSize', // param base name
+ 'integer', // openApiType
+ 'form', // style
+ true, // explode
+ false // required
+ ) ?? []);
+ // query params
+ $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+ $sort,
+ 'sort', // param base name
+ 'string', // openApiType
+ 'form', // style
+ true, // explode
+ false // required
+ ) ?? []);
+ // query params
+ $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+ $page_token,
+ 'pageToken', // param base name
+ 'string', // openApiType
+ 'form', // style
+ true, // explode
+ false // required
+ ) ?? []);
+ // query params
+ $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+ $limit,
+ 'limit', // param base name
+ 'integer', // openApiType
+ 'form', // style
+ true, // explode
+ false // required
+ ) ?? []);
+ // query params
+ $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+ $limit_total_count,
+ 'limitTotalCount', // param base name
+ 'boolean', // openApiType
+ 'form', // style
+ true, // explode
+ false // required
+ ) ?? []);
+
+
+ // path params
+ if ($account_id !== null) {
+ $resourcePath = str_replace(
+ '{accountId}',
+ ObjectSerializer::toPathValue($account_id),
+ $resourcePath
+ );
+ }
+
+
+ $headers = $this->headerSelector->selectHeaders(
+ ['application/json', ],
+ $contentType,
+ $multipart
+ );
+
+
+ // this endpoint requires HTTP basic authentication
+ if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) {
+ $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword());
+ }
+
+ // this endpoint requires OAuth (access token)
+ if (!empty($this->config->getAccessToken())) {
+ $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken();
+ }
+
+ $defaultHeaders = [];
+ if ($this->config->getUserAgent()) {
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
+ }
+
+ $headers = array_merge(
+ $defaultHeaders,
+ $headerParams,
+ $headers
+ );
+
+ if ($this->config->getIgnoreOperationHosts()) {
+ $operationHost = $this->config->getHost();
+ } else {
+ # Preserve the original behavior of server indexing.
+ if ($hostIndex === null) {
+ $hostIndex = $this->hostIndex;
+ }
+
+ $hostSettings = $this->getHostSettingsForlistMessages();
+
+ if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) {
+ throw new InvalidArgumentException("Invalid index {$hostIndex} when selecting the host. Must be less than ".count($hostSettings));
+ }
+ $operationHost = Configuration::getHostString($hostSettings, $hostIndex, $variables);
+ }
+ $query = ObjectSerializer::buildQuery($queryParams);
+ return new Request(
+ 'GET',
+ $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
+ $headers,
+ $httpBody
+ );
+ }
+
+ /**
+ * Returns an array of host settings for Operation listMessages
+ *
+ * @return array an array of host settings
+ */
+ protected function getHostSettingsForlistMessages(): array
+ {
+ return [
+ [
+ "url" => "https://messaging.bandwidth.com/api/v2",
+ "description" => "Production",
+ ]
+ ];
+ }
+
+ /**
+ * Create http client option
+ *
+ * @throws \RuntimeException on file opening failure
+ * @return array of http client options
+ */
+ protected function createHttpClientOption(): array
+ {
+ $options = [];
+ if ($this->config->getDebug()) {
+ $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a');
+ if (!$options[RequestOptions::DEBUG]) {
+ throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile());
+ }
+ }
+
+ return $options;
+ }
+
+ private function handleResponseWithDataType(
+ string $dataType,
+ RequestInterface $request,
+ ResponseInterface $response,
+ ): array {
+ if (in_array($dataType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($dataType !== 'string') {
+ try {
+ $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR);
+ } catch (\JsonException $exception) {
+ throw new ApiException(
+ sprintf(
+ 'Error JSON decoding server response (%s)',
+ $request->getUri()
+ ),
+ $response->getStatusCode(),
+ $response->getHeaders(),
+ $content
+ );
+ }
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $dataType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ }
+
+ private function responseWithinRangeCode(
+ string $rangeCode,
+ int $statusCode,
+ ): bool {
+ $left = (int) ($rangeCode[0].'00');
+ $right = (int) ($rangeCode[0].'99');
+
+ return $statusCode >= $left && $statusCode <= $right;
+ }
+}
diff --git a/src/Api/MultiChannelApi.php b/src/Api/MultiChannelApi.php
new file mode 100644
index 0000000..46f9214
--- /dev/null
+++ b/src/Api/MultiChannelApi.php
@@ -0,0 +1,678 @@
+ $contentTypes **/
+ public const contentTypes = [
+ 'createMultiChannelMessage' => [
+ 'application/json',
+ ],
+ ];
+
+ /**
+ * @param ClientInterface|null $client
+ * @param Configuration|null $config
+ * @param HeaderSelector|null $selector
+ * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec
+ */
+ public function __construct(
+ ?ClientInterface $client = null,
+ ?Configuration $config = null,
+ ?HeaderSelector $selector = null,
+ int $hostIndex = 0
+ ) {
+ $this->client = $client ?: new Client();
+ $this->config = $config ?: Configuration::getDefaultConfiguration();
+ $this->headerSelector = $selector ?: new HeaderSelector();
+ $this->hostIndex = $hostIndex;
+ }
+
+ /**
+ * Set the host index
+ *
+ * @param int $hostIndex Host index (required)
+ */
+ public function setHostIndex(int $hostIndex): void
+ {
+ $this->hostIndex = $hostIndex;
+ }
+
+ /**
+ * Get the host index
+ *
+ * @return int Host index
+ */
+ public function getHostIndex(): int
+ {
+ return $this->hostIndex;
+ }
+
+ /**
+ * @return Configuration
+ */
+ public function getConfig(): Configuration
+ {
+ return $this->config;
+ }
+
+ /**
+ * Operation createMultiChannelMessage
+ *
+ * Create Multi-Channel Message
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://messaging.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param \Bandwidth\Model\MultiChannelMessageRequest $multi_channel_message_request multi_channel_message_request (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createMultiChannelMessage'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return \Bandwidth\Model\CreateMultiChannelMessageResponse|\Bandwidth\Model\MultiChannelError
+ */
+ public function createMultiChannelMessage(
+ string $account_id,
+ \Bandwidth\Model\MultiChannelMessageRequest $multi_channel_message_request,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['createMultiChannelMessage'][0]
+ ): \Bandwidth\Model\CreateMultiChannelMessageResponse|\Bandwidth\Model\MultiChannelError
+ {
+ list($response) = $this->createMultiChannelMessageWithHttpInfo($account_id, $multi_channel_message_request, $hostIndex, $variables, $contentType);
+ return $response;
+ }
+
+ /**
+ * Operation createMultiChannelMessageWithHttpInfo
+ *
+ * Create Multi-Channel Message
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://messaging.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param \Bandwidth\Model\MultiChannelMessageRequest $multi_channel_message_request (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createMultiChannelMessage'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return array{0: \Bandwidth\Model\CreateMultiChannelMessageResponse|\Bandwidth\Model\MultiChannelError, 1: int, 2: array} [response data, HTTP status code, HTTP response headers]
+ */
+ public function createMultiChannelMessageWithHttpInfo(
+ string $account_id,
+ \Bandwidth\Model\MultiChannelMessageRequest $multi_channel_message_request,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['createMultiChannelMessage'][0]
+ ): array
+ {
+ $request = $this->createMultiChannelMessageRequest($account_id, $multi_channel_message_request, $hostIndex, $variables, $contentType);
+
+ try {
+ $options = $this->createHttpClientOption();
+ try {
+ $response = $this->client->send($request, $options);
+ } catch (RequestException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
+ $e->getResponse() ? (string) $e->getResponse()->getBody() : null
+ );
+ } catch (ConnectException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ null,
+ null
+ );
+ }
+
+ $statusCode = $response->getStatusCode();
+
+ switch($statusCode) {
+ case 202:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\CreateMultiChannelMessageResponse',
+ $request,
+ $response,
+ );
+ case 400:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\MultiChannelError',
+ $request,
+ $response,
+ );
+ case 401:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\MultiChannelError',
+ $request,
+ $response,
+ );
+ case 403:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\MultiChannelError',
+ $request,
+ $response,
+ );
+ case 404:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\MultiChannelError',
+ $request,
+ $response,
+ );
+ case 405:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\MultiChannelError',
+ $request,
+ $response,
+ );
+ case 415:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\MultiChannelError',
+ $request,
+ $response,
+ );
+ case 429:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\MultiChannelError',
+ $request,
+ $response,
+ );
+ case 500:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\MultiChannelError',
+ $request,
+ $response,
+ );
+ }
+
+ if ($statusCode < 200 || $statusCode > 299) {
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ (string) $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\CreateMultiChannelMessageResponse',
+ $request,
+ $response,
+ );
+ } catch (ApiException $e) {
+ switch ($e->getCode()) {
+ case 202:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\CreateMultiChannelMessageResponse',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 400:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\MultiChannelError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 401:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\MultiChannelError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 403:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\MultiChannelError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 404:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\MultiChannelError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 405:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\MultiChannelError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 415:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\MultiChannelError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 429:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\MultiChannelError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 500:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\MultiChannelError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ }
+
+ throw $e;
+ }
+ }
+
+ /**
+ * Operation createMultiChannelMessageAsync
+ *
+ * Create Multi-Channel Message
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://messaging.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param \Bandwidth\Model\MultiChannelMessageRequest $multi_channel_message_request (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createMultiChannelMessage'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function createMultiChannelMessageAsync(
+ string $account_id,
+ \Bandwidth\Model\MultiChannelMessageRequest $multi_channel_message_request,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['createMultiChannelMessage'][0]
+ ): PromiseInterface
+ {
+ return $this->createMultiChannelMessageAsyncWithHttpInfo($account_id, $multi_channel_message_request, $hostIndex, $variables, $contentType)
+ ->then(
+ function ($response) {
+ return $response[0];
+ }
+ );
+ }
+
+ /**
+ * Operation createMultiChannelMessageAsyncWithHttpInfo
+ *
+ * Create Multi-Channel Message
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://messaging.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param \Bandwidth\Model\MultiChannelMessageRequest $multi_channel_message_request (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createMultiChannelMessage'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function createMultiChannelMessageAsyncWithHttpInfo(
+ string $account_id,
+ \Bandwidth\Model\MultiChannelMessageRequest $multi_channel_message_request,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['createMultiChannelMessage'][0]
+ ): PromiseInterface
+ {
+ $returnType = '\Bandwidth\Model\CreateMultiChannelMessageResponse';
+ $request = $this->createMultiChannelMessageRequest($account_id, $multi_channel_message_request, $hostIndex, $variables, $contentType);
+
+ return $this->client
+ ->sendAsync($request, $this->createHttpClientOption())
+ ->then(
+ function ($response) use ($returnType) {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ },
+ function ($exception) {
+ $response = $exception->getResponse();
+ $statusCode = $response->getStatusCode();
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ $exception->getRequest()->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+ );
+ }
+
+ /**
+ * Create request for operation 'createMultiChannelMessage'
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://messaging.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param \Bandwidth\Model\MultiChannelMessageRequest $multi_channel_message_request (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createMultiChannelMessage'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return \GuzzleHttp\Psr7\Request
+ */
+ public function createMultiChannelMessageRequest(
+ string $account_id,
+ \Bandwidth\Model\MultiChannelMessageRequest $multi_channel_message_request,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['createMultiChannelMessage'][0]
+ ): Request
+ {
+ // verify the required parameter 'account_id' is set
+ if ($account_id === null || (is_array($account_id) && count($account_id) === 0)) {
+ throw new InvalidArgumentException(
+ 'Missing the required parameter $account_id when calling createMultiChannelMessage'
+ );
+ }
+ // verify the required parameter 'multi_channel_message_request' is set
+ if ($multi_channel_message_request === null || (is_array($multi_channel_message_request) && count($multi_channel_message_request) === 0)) {
+ throw new InvalidArgumentException(
+ 'Missing the required parameter $multi_channel_message_request when calling createMultiChannelMessage'
+ );
+ }
+
+ $resourcePath = '/users/{accountId}/messages/multiChannel';
+ $formParams = [];
+ $queryParams = [];
+ $headerParams = [];
+ $httpBody = '';
+ $multipart = false;
+
+
+
+ // path params
+ if ($account_id !== null) {
+ $resourcePath = str_replace(
+ '{accountId}',
+ ObjectSerializer::toPathValue($account_id),
+ $resourcePath
+ );
+ }
+
+
+ $headers = $this->headerSelector->selectHeaders(
+ ['application/json', ],
+ $contentType,
+ $multipart
+ );
+
+ // for model (json/xml)
+ if (isset($multi_channel_message_request)) {
+ if (stripos($headers['Content-Type'], 'application/json') !== false) {
+ # if Content-Type contains "application/json", json_encode the body
+ $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($multi_channel_message_request));
+ } else {
+ $httpBody = $multi_channel_message_request;
+ }
+ } elseif (count($formParams) > 0) {
+ if ($multipart) {
+ $multipartContents = [];
+ foreach ($formParams as $formParamName => $formParamValue) {
+ $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
+ foreach ($formParamValueItems as $formParamValueItem) {
+ $multipartContents[] = [
+ 'name' => $formParamName,
+ 'contents' => $formParamValueItem
+ ];
+ }
+ }
+ // for HTTP post (form)
+ $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents);
+
+ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
+ # if Content-Type contains "application/json", json_encode the form parameters
+ $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams);
+ } else {
+ // for HTTP post (form)
+ $httpBody = ObjectSerializer::buildQuery($formParams);
+ }
+ }
+
+ // this endpoint requires HTTP basic authentication
+ if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) {
+ $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword());
+ }
+
+ // this endpoint requires OAuth (access token)
+ if (!empty($this->config->getAccessToken())) {
+ $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken();
+ }
+
+ $defaultHeaders = [];
+ if ($this->config->getUserAgent()) {
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
+ }
+
+ $headers = array_merge(
+ $defaultHeaders,
+ $headerParams,
+ $headers
+ );
+
+ if ($this->config->getIgnoreOperationHosts()) {
+ $operationHost = $this->config->getHost();
+ } else {
+ # Preserve the original behavior of server indexing.
+ if ($hostIndex === null) {
+ $hostIndex = $this->hostIndex;
+ }
+
+ $hostSettings = $this->getHostSettingsForcreateMultiChannelMessage();
+
+ if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) {
+ throw new InvalidArgumentException("Invalid index {$hostIndex} when selecting the host. Must be less than ".count($hostSettings));
+ }
+ $operationHost = Configuration::getHostString($hostSettings, $hostIndex, $variables);
+ }
+ $query = ObjectSerializer::buildQuery($queryParams);
+ return new Request(
+ 'POST',
+ $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
+ $headers,
+ $httpBody
+ );
+ }
+
+ /**
+ * Returns an array of host settings for Operation createMultiChannelMessage
+ *
+ * @return array an array of host settings
+ */
+ protected function getHostSettingsForcreateMultiChannelMessage(): array
+ {
+ return [
+ [
+ "url" => "https://messaging.bandwidth.com/api/v2",
+ "description" => "Production",
+ ]
+ ];
+ }
+
+ /**
+ * Create http client option
+ *
+ * @throws \RuntimeException on file opening failure
+ * @return array of http client options
+ */
+ protected function createHttpClientOption(): array
+ {
+ $options = [];
+ if ($this->config->getDebug()) {
+ $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a');
+ if (!$options[RequestOptions::DEBUG]) {
+ throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile());
+ }
+ }
+
+ return $options;
+ }
+
+ private function handleResponseWithDataType(
+ string $dataType,
+ RequestInterface $request,
+ ResponseInterface $response,
+ ): array {
+ if (in_array($dataType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($dataType !== 'string') {
+ try {
+ $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR);
+ } catch (\JsonException $exception) {
+ throw new ApiException(
+ sprintf(
+ 'Error JSON decoding server response (%s)',
+ $request->getUri()
+ ),
+ $response->getStatusCode(),
+ $response->getHeaders(),
+ $content
+ );
+ }
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $dataType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ }
+
+ private function responseWithinRangeCode(
+ string $rangeCode,
+ int $statusCode,
+ ): bool {
+ $left = (int) ($rangeCode[0].'00');
+ $right = (int) ($rangeCode[0].'99');
+
+ return $statusCode >= $left && $statusCode <= $right;
+ }
+}
diff --git a/src/Api/PhoneNumberLookupApi.php b/src/Api/PhoneNumberLookupApi.php
new file mode 100644
index 0000000..845ee9c
--- /dev/null
+++ b/src/Api/PhoneNumberLookupApi.php
@@ -0,0 +1,1346 @@
+ $contentTypes **/
+ public const contentTypes = [
+ 'createAsyncBulkLookup' => [
+ 'application/json',
+ ],
+ 'createSyncLookup' => [
+ 'application/json',
+ ],
+ 'getAsyncBulkLookup' => [
+ 'application/json',
+ ],
+ ];
+
+ /**
+ * @param ClientInterface|null $client
+ * @param Configuration|null $config
+ * @param HeaderSelector|null $selector
+ * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec
+ */
+ public function __construct(
+ ?ClientInterface $client = null,
+ ?Configuration $config = null,
+ ?HeaderSelector $selector = null,
+ int $hostIndex = 0
+ ) {
+ $this->client = $client ?: new Client();
+ $this->config = $config ?: Configuration::getDefaultConfiguration();
+ $this->headerSelector = $selector ?: new HeaderSelector();
+ $this->hostIndex = $hostIndex;
+ }
+
+ /**
+ * Set the host index
+ *
+ * @param int $hostIndex Host index (required)
+ */
+ public function setHostIndex(int $hostIndex): void
+ {
+ $this->hostIndex = $hostIndex;
+ }
+
+ /**
+ * Get the host index
+ *
+ * @return int Host index
+ */
+ public function getHostIndex(): int
+ {
+ return $this->hostIndex;
+ }
+
+ /**
+ * @return Configuration
+ */
+ public function getConfig(): Configuration
+ {
+ return $this->config;
+ }
+
+ /**
+ * Operation createAsyncBulkLookup
+ *
+ * Create Asynchronous Bulk Number Lookup
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://api.bandwidth.com/v2
+ *
+ * @param string $account_id account_id (required)
+ * @param \Bandwidth\Model\AsyncLookupRequest $async_lookup_request Asynchronous bulk phone number lookup request. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createAsyncBulkLookup'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return \Bandwidth\Model\CreateAsyncBulkLookupResponse|\Bandwidth\Model\LookupErrorResponse
+ */
+ public function createAsyncBulkLookup(
+ string $account_id,
+ \Bandwidth\Model\AsyncLookupRequest $async_lookup_request,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['createAsyncBulkLookup'][0]
+ ): \Bandwidth\Model\CreateAsyncBulkLookupResponse|\Bandwidth\Model\LookupErrorResponse
+ {
+ list($response) = $this->createAsyncBulkLookupWithHttpInfo($account_id, $async_lookup_request, $hostIndex, $variables, $contentType);
+ return $response;
+ }
+
+ /**
+ * Operation createAsyncBulkLookupWithHttpInfo
+ *
+ * Create Asynchronous Bulk Number Lookup
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://api.bandwidth.com/v2
+ *
+ * @param string $account_id (required)
+ * @param \Bandwidth\Model\AsyncLookupRequest $async_lookup_request Asynchronous bulk phone number lookup request. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createAsyncBulkLookup'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return array{0: \Bandwidth\Model\CreateAsyncBulkLookupResponse|\Bandwidth\Model\LookupErrorResponse, 1: int, 2: array} [response data, HTTP status code, HTTP response headers]
+ */
+ public function createAsyncBulkLookupWithHttpInfo(
+ string $account_id,
+ \Bandwidth\Model\AsyncLookupRequest $async_lookup_request,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['createAsyncBulkLookup'][0]
+ ): array
+ {
+ $request = $this->createAsyncBulkLookupRequest($account_id, $async_lookup_request, $hostIndex, $variables, $contentType);
+
+ try {
+ $options = $this->createHttpClientOption();
+ try {
+ $response = $this->client->send($request, $options);
+ } catch (RequestException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
+ $e->getResponse() ? (string) $e->getResponse()->getBody() : null
+ );
+ } catch (ConnectException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ null,
+ null
+ );
+ }
+
+ $statusCode = $response->getStatusCode();
+
+ switch($statusCode) {
+ case 202:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\CreateAsyncBulkLookupResponse',
+ $request,
+ $response,
+ );
+ default:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\LookupErrorResponse',
+ $request,
+ $response,
+ );
+ }
+
+ if ($statusCode < 200 || $statusCode > 299) {
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ (string) $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\CreateAsyncBulkLookupResponse',
+ $request,
+ $response,
+ );
+ } catch (ApiException $e) {
+ switch ($e->getCode()) {
+ case 202:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\CreateAsyncBulkLookupResponse',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ default:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\LookupErrorResponse',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ }
+
+ throw $e;
+ }
+ }
+
+ /**
+ * Operation createAsyncBulkLookupAsync
+ *
+ * Create Asynchronous Bulk Number Lookup
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://api.bandwidth.com/v2
+ *
+ * @param string $account_id (required)
+ * @param \Bandwidth\Model\AsyncLookupRequest $async_lookup_request Asynchronous bulk phone number lookup request. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createAsyncBulkLookup'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function createAsyncBulkLookupAsync(
+ string $account_id,
+ \Bandwidth\Model\AsyncLookupRequest $async_lookup_request,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['createAsyncBulkLookup'][0]
+ ): PromiseInterface
+ {
+ return $this->createAsyncBulkLookupAsyncWithHttpInfo($account_id, $async_lookup_request, $hostIndex, $variables, $contentType)
+ ->then(
+ function ($response) {
+ return $response[0];
+ }
+ );
+ }
+
+ /**
+ * Operation createAsyncBulkLookupAsyncWithHttpInfo
+ *
+ * Create Asynchronous Bulk Number Lookup
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://api.bandwidth.com/v2
+ *
+ * @param string $account_id (required)
+ * @param \Bandwidth\Model\AsyncLookupRequest $async_lookup_request Asynchronous bulk phone number lookup request. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createAsyncBulkLookup'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function createAsyncBulkLookupAsyncWithHttpInfo(
+ string $account_id,
+ \Bandwidth\Model\AsyncLookupRequest $async_lookup_request,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['createAsyncBulkLookup'][0]
+ ): PromiseInterface
+ {
+ $returnType = '\Bandwidth\Model\CreateAsyncBulkLookupResponse';
+ $request = $this->createAsyncBulkLookupRequest($account_id, $async_lookup_request, $hostIndex, $variables, $contentType);
+
+ return $this->client
+ ->sendAsync($request, $this->createHttpClientOption())
+ ->then(
+ function ($response) use ($returnType) {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ },
+ function ($exception) {
+ $response = $exception->getResponse();
+ $statusCode = $response->getStatusCode();
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ $exception->getRequest()->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+ );
+ }
+
+ /**
+ * Create request for operation 'createAsyncBulkLookup'
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://api.bandwidth.com/v2
+ *
+ * @param string $account_id (required)
+ * @param \Bandwidth\Model\AsyncLookupRequest $async_lookup_request Asynchronous bulk phone number lookup request. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createAsyncBulkLookup'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return \GuzzleHttp\Psr7\Request
+ */
+ public function createAsyncBulkLookupRequest(
+ string $account_id,
+ \Bandwidth\Model\AsyncLookupRequest $async_lookup_request,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['createAsyncBulkLookup'][0]
+ ): Request
+ {
+ // verify the required parameter 'account_id' is set
+ if ($account_id === null || (is_array($account_id) && count($account_id) === 0)) {
+ throw new InvalidArgumentException(
+ 'Missing the required parameter $account_id when calling createAsyncBulkLookup'
+ );
+ }
+ // verify the required parameter 'async_lookup_request' is set
+ if ($async_lookup_request === null || (is_array($async_lookup_request) && count($async_lookup_request) === 0)) {
+ throw new InvalidArgumentException(
+ 'Missing the required parameter $async_lookup_request when calling createAsyncBulkLookup'
+ );
+ }
+
+ $resourcePath = '/accounts/{accountId}/phoneNumberLookup/bulk';
+ $formParams = [];
+ $queryParams = [];
+ $headerParams = [];
+ $httpBody = '';
+ $multipart = false;
+
+
+
+ // path params
+ if ($account_id !== null) {
+ $resourcePath = str_replace(
+ '{accountId}',
+ ObjectSerializer::toPathValue($account_id),
+ $resourcePath
+ );
+ }
+
+
+ $headers = $this->headerSelector->selectHeaders(
+ ['application/json', ],
+ $contentType,
+ $multipart
+ );
+
+ // for model (json/xml)
+ if (isset($async_lookup_request)) {
+ if (stripos($headers['Content-Type'], 'application/json') !== false) {
+ # if Content-Type contains "application/json", json_encode the body
+ $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($async_lookup_request));
+ } else {
+ $httpBody = $async_lookup_request;
+ }
+ } elseif (count($formParams) > 0) {
+ if ($multipart) {
+ $multipartContents = [];
+ foreach ($formParams as $formParamName => $formParamValue) {
+ $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
+ foreach ($formParamValueItems as $formParamValueItem) {
+ $multipartContents[] = [
+ 'name' => $formParamName,
+ 'contents' => $formParamValueItem
+ ];
+ }
+ }
+ // for HTTP post (form)
+ $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents);
+
+ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
+ # if Content-Type contains "application/json", json_encode the form parameters
+ $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams);
+ } else {
+ // for HTTP post (form)
+ $httpBody = ObjectSerializer::buildQuery($formParams);
+ }
+ }
+
+ // this endpoint requires HTTP basic authentication
+ if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) {
+ $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword());
+ }
+
+ // this endpoint requires OAuth (access token)
+ if (!empty($this->config->getAccessToken())) {
+ $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken();
+ }
+
+ $defaultHeaders = [];
+ if ($this->config->getUserAgent()) {
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
+ }
+
+ $headers = array_merge(
+ $defaultHeaders,
+ $headerParams,
+ $headers
+ );
+
+ if ($this->config->getIgnoreOperationHosts()) {
+ $operationHost = $this->config->getHost();
+ } else {
+ # Preserve the original behavior of server indexing.
+ if ($hostIndex === null) {
+ $hostIndex = $this->hostIndex;
+ }
+
+ $hostSettings = $this->getHostSettingsForcreateAsyncBulkLookup();
+
+ if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) {
+ throw new InvalidArgumentException("Invalid index {$hostIndex} when selecting the host. Must be less than ".count($hostSettings));
+ }
+ $operationHost = Configuration::getHostString($hostSettings, $hostIndex, $variables);
+ }
+ $query = ObjectSerializer::buildQuery($queryParams);
+ return new Request(
+ 'POST',
+ $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
+ $headers,
+ $httpBody
+ );
+ }
+
+ /**
+ * Returns an array of host settings for Operation createAsyncBulkLookup
+ *
+ * @return array an array of host settings
+ */
+ protected function getHostSettingsForcreateAsyncBulkLookup(): array
+ {
+ return [
+ [
+ "url" => "https://api.bandwidth.com/v2",
+ "description" => "Production",
+ ]
+ ];
+ }
+
+ /**
+ * Operation createSyncLookup
+ *
+ * Create Synchronous Number Lookup
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://api.bandwidth.com/v2
+ *
+ * @param string $account_id account_id (required)
+ * @param \Bandwidth\Model\SyncLookupRequest $sync_lookup_request Synchronous phone number lookup request. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createSyncLookup'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return \Bandwidth\Model\CreateSyncLookupResponse|\Bandwidth\Model\LookupErrorResponse
+ */
+ public function createSyncLookup(
+ string $account_id,
+ \Bandwidth\Model\SyncLookupRequest $sync_lookup_request,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['createSyncLookup'][0]
+ ): \Bandwidth\Model\CreateSyncLookupResponse|\Bandwidth\Model\LookupErrorResponse
+ {
+ list($response) = $this->createSyncLookupWithHttpInfo($account_id, $sync_lookup_request, $hostIndex, $variables, $contentType);
+ return $response;
+ }
+
+ /**
+ * Operation createSyncLookupWithHttpInfo
+ *
+ * Create Synchronous Number Lookup
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://api.bandwidth.com/v2
+ *
+ * @param string $account_id (required)
+ * @param \Bandwidth\Model\SyncLookupRequest $sync_lookup_request Synchronous phone number lookup request. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createSyncLookup'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return array{0: \Bandwidth\Model\CreateSyncLookupResponse|\Bandwidth\Model\LookupErrorResponse, 1: int, 2: array} [response data, HTTP status code, HTTP response headers]
+ */
+ public function createSyncLookupWithHttpInfo(
+ string $account_id,
+ \Bandwidth\Model\SyncLookupRequest $sync_lookup_request,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['createSyncLookup'][0]
+ ): array
+ {
+ $request = $this->createSyncLookupRequest($account_id, $sync_lookup_request, $hostIndex, $variables, $contentType);
+
+ try {
+ $options = $this->createHttpClientOption();
+ try {
+ $response = $this->client->send($request, $options);
+ } catch (RequestException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
+ $e->getResponse() ? (string) $e->getResponse()->getBody() : null
+ );
+ } catch (ConnectException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ null,
+ null
+ );
+ }
+
+ $statusCode = $response->getStatusCode();
+
+ switch($statusCode) {
+ case 200:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\CreateSyncLookupResponse',
+ $request,
+ $response,
+ );
+ default:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\LookupErrorResponse',
+ $request,
+ $response,
+ );
+ }
+
+ if ($statusCode < 200 || $statusCode > 299) {
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ (string) $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\CreateSyncLookupResponse',
+ $request,
+ $response,
+ );
+ } catch (ApiException $e) {
+ switch ($e->getCode()) {
+ case 200:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\CreateSyncLookupResponse',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ default:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\LookupErrorResponse',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ }
+
+ throw $e;
+ }
+ }
+
+ /**
+ * Operation createSyncLookupAsync
+ *
+ * Create Synchronous Number Lookup
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://api.bandwidth.com/v2
+ *
+ * @param string $account_id (required)
+ * @param \Bandwidth\Model\SyncLookupRequest $sync_lookup_request Synchronous phone number lookup request. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createSyncLookup'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function createSyncLookupAsync(
+ string $account_id,
+ \Bandwidth\Model\SyncLookupRequest $sync_lookup_request,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['createSyncLookup'][0]
+ ): PromiseInterface
+ {
+ return $this->createSyncLookupAsyncWithHttpInfo($account_id, $sync_lookup_request, $hostIndex, $variables, $contentType)
+ ->then(
+ function ($response) {
+ return $response[0];
+ }
+ );
+ }
+
+ /**
+ * Operation createSyncLookupAsyncWithHttpInfo
+ *
+ * Create Synchronous Number Lookup
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://api.bandwidth.com/v2
+ *
+ * @param string $account_id (required)
+ * @param \Bandwidth\Model\SyncLookupRequest $sync_lookup_request Synchronous phone number lookup request. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createSyncLookup'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function createSyncLookupAsyncWithHttpInfo(
+ string $account_id,
+ \Bandwidth\Model\SyncLookupRequest $sync_lookup_request,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['createSyncLookup'][0]
+ ): PromiseInterface
+ {
+ $returnType = '\Bandwidth\Model\CreateSyncLookupResponse';
+ $request = $this->createSyncLookupRequest($account_id, $sync_lookup_request, $hostIndex, $variables, $contentType);
+
+ return $this->client
+ ->sendAsync($request, $this->createHttpClientOption())
+ ->then(
+ function ($response) use ($returnType) {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ },
+ function ($exception) {
+ $response = $exception->getResponse();
+ $statusCode = $response->getStatusCode();
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ $exception->getRequest()->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+ );
+ }
+
+ /**
+ * Create request for operation 'createSyncLookup'
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://api.bandwidth.com/v2
+ *
+ * @param string $account_id (required)
+ * @param \Bandwidth\Model\SyncLookupRequest $sync_lookup_request Synchronous phone number lookup request. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createSyncLookup'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return \GuzzleHttp\Psr7\Request
+ */
+ public function createSyncLookupRequest(
+ string $account_id,
+ \Bandwidth\Model\SyncLookupRequest $sync_lookup_request,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['createSyncLookup'][0]
+ ): Request
+ {
+ // verify the required parameter 'account_id' is set
+ if ($account_id === null || (is_array($account_id) && count($account_id) === 0)) {
+ throw new InvalidArgumentException(
+ 'Missing the required parameter $account_id when calling createSyncLookup'
+ );
+ }
+ // verify the required parameter 'sync_lookup_request' is set
+ if ($sync_lookup_request === null || (is_array($sync_lookup_request) && count($sync_lookup_request) === 0)) {
+ throw new InvalidArgumentException(
+ 'Missing the required parameter $sync_lookup_request when calling createSyncLookup'
+ );
+ }
+
+ $resourcePath = '/accounts/{accountId}/phoneNumberLookup';
+ $formParams = [];
+ $queryParams = [];
+ $headerParams = [];
+ $httpBody = '';
+ $multipart = false;
+
+
+
+ // path params
+ if ($account_id !== null) {
+ $resourcePath = str_replace(
+ '{accountId}',
+ ObjectSerializer::toPathValue($account_id),
+ $resourcePath
+ );
+ }
+
+
+ $headers = $this->headerSelector->selectHeaders(
+ ['application/json', ],
+ $contentType,
+ $multipart
+ );
+
+ // for model (json/xml)
+ if (isset($sync_lookup_request)) {
+ if (stripos($headers['Content-Type'], 'application/json') !== false) {
+ # if Content-Type contains "application/json", json_encode the body
+ $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($sync_lookup_request));
+ } else {
+ $httpBody = $sync_lookup_request;
+ }
+ } elseif (count($formParams) > 0) {
+ if ($multipart) {
+ $multipartContents = [];
+ foreach ($formParams as $formParamName => $formParamValue) {
+ $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
+ foreach ($formParamValueItems as $formParamValueItem) {
+ $multipartContents[] = [
+ 'name' => $formParamName,
+ 'contents' => $formParamValueItem
+ ];
+ }
+ }
+ // for HTTP post (form)
+ $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents);
+
+ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
+ # if Content-Type contains "application/json", json_encode the form parameters
+ $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams);
+ } else {
+ // for HTTP post (form)
+ $httpBody = ObjectSerializer::buildQuery($formParams);
+ }
+ }
+
+ // this endpoint requires HTTP basic authentication
+ if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) {
+ $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword());
+ }
+
+ // this endpoint requires OAuth (access token)
+ if (!empty($this->config->getAccessToken())) {
+ $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken();
+ }
+
+ $defaultHeaders = [];
+ if ($this->config->getUserAgent()) {
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
+ }
+
+ $headers = array_merge(
+ $defaultHeaders,
+ $headerParams,
+ $headers
+ );
+
+ if ($this->config->getIgnoreOperationHosts()) {
+ $operationHost = $this->config->getHost();
+ } else {
+ # Preserve the original behavior of server indexing.
+ if ($hostIndex === null) {
+ $hostIndex = $this->hostIndex;
+ }
+
+ $hostSettings = $this->getHostSettingsForcreateSyncLookup();
+
+ if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) {
+ throw new InvalidArgumentException("Invalid index {$hostIndex} when selecting the host. Must be less than ".count($hostSettings));
+ }
+ $operationHost = Configuration::getHostString($hostSettings, $hostIndex, $variables);
+ }
+ $query = ObjectSerializer::buildQuery($queryParams);
+ return new Request(
+ 'POST',
+ $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
+ $headers,
+ $httpBody
+ );
+ }
+
+ /**
+ * Returns an array of host settings for Operation createSyncLookup
+ *
+ * @return array an array of host settings
+ */
+ protected function getHostSettingsForcreateSyncLookup(): array
+ {
+ return [
+ [
+ "url" => "https://api.bandwidth.com/v2",
+ "description" => "Production",
+ ]
+ ];
+ }
+
+ /**
+ * Operation getAsyncBulkLookup
+ *
+ * Get Asynchronous Bulk Number Lookup
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://api.bandwidth.com/v2
+ *
+ * @param string $account_id account_id (required)
+ * @param string $request_id request_id (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAsyncBulkLookup'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return \Bandwidth\Model\GetAsyncBulkLookupResponse|\Bandwidth\Model\LookupErrorResponse
+ */
+ public function getAsyncBulkLookup(
+ string $account_id,
+ string $request_id,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['getAsyncBulkLookup'][0]
+ ): \Bandwidth\Model\GetAsyncBulkLookupResponse|\Bandwidth\Model\LookupErrorResponse
+ {
+ list($response) = $this->getAsyncBulkLookupWithHttpInfo($account_id, $request_id, $hostIndex, $variables, $contentType);
+ return $response;
+ }
+
+ /**
+ * Operation getAsyncBulkLookupWithHttpInfo
+ *
+ * Get Asynchronous Bulk Number Lookup
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://api.bandwidth.com/v2
+ *
+ * @param string $account_id (required)
+ * @param string $request_id (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAsyncBulkLookup'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return array{0: \Bandwidth\Model\GetAsyncBulkLookupResponse|\Bandwidth\Model\LookupErrorResponse, 1: int, 2: array} [response data, HTTP status code, HTTP response headers]
+ */
+ public function getAsyncBulkLookupWithHttpInfo(
+ string $account_id,
+ string $request_id,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['getAsyncBulkLookup'][0]
+ ): array
+ {
+ $request = $this->getAsyncBulkLookupRequest($account_id, $request_id, $hostIndex, $variables, $contentType);
+
+ try {
+ $options = $this->createHttpClientOption();
+ try {
+ $response = $this->client->send($request, $options);
+ } catch (RequestException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
+ $e->getResponse() ? (string) $e->getResponse()->getBody() : null
+ );
+ } catch (ConnectException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ null,
+ null
+ );
+ }
+
+ $statusCode = $response->getStatusCode();
+
+ switch($statusCode) {
+ case 200:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\GetAsyncBulkLookupResponse',
+ $request,
+ $response,
+ );
+ default:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\LookupErrorResponse',
+ $request,
+ $response,
+ );
+ }
+
+ if ($statusCode < 200 || $statusCode > 299) {
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ (string) $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\GetAsyncBulkLookupResponse',
+ $request,
+ $response,
+ );
+ } catch (ApiException $e) {
+ switch ($e->getCode()) {
+ case 200:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\GetAsyncBulkLookupResponse',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ default:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\LookupErrorResponse',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ }
+
+ throw $e;
+ }
+ }
+
+ /**
+ * Operation getAsyncBulkLookupAsync
+ *
+ * Get Asynchronous Bulk Number Lookup
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://api.bandwidth.com/v2
+ *
+ * @param string $account_id (required)
+ * @param string $request_id (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAsyncBulkLookup'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function getAsyncBulkLookupAsync(
+ string $account_id,
+ string $request_id,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['getAsyncBulkLookup'][0]
+ ): PromiseInterface
+ {
+ return $this->getAsyncBulkLookupAsyncWithHttpInfo($account_id, $request_id, $hostIndex, $variables, $contentType)
+ ->then(
+ function ($response) {
+ return $response[0];
+ }
+ );
+ }
+
+ /**
+ * Operation getAsyncBulkLookupAsyncWithHttpInfo
+ *
+ * Get Asynchronous Bulk Number Lookup
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://api.bandwidth.com/v2
+ *
+ * @param string $account_id (required)
+ * @param string $request_id (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAsyncBulkLookup'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function getAsyncBulkLookupAsyncWithHttpInfo(
+ string $account_id,
+ string $request_id,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['getAsyncBulkLookup'][0]
+ ): PromiseInterface
+ {
+ $returnType = '\Bandwidth\Model\GetAsyncBulkLookupResponse';
+ $request = $this->getAsyncBulkLookupRequest($account_id, $request_id, $hostIndex, $variables, $contentType);
+
+ return $this->client
+ ->sendAsync($request, $this->createHttpClientOption())
+ ->then(
+ function ($response) use ($returnType) {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ },
+ function ($exception) {
+ $response = $exception->getResponse();
+ $statusCode = $response->getStatusCode();
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ $exception->getRequest()->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+ );
+ }
+
+ /**
+ * Create request for operation 'getAsyncBulkLookup'
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://api.bandwidth.com/v2
+ *
+ * @param string $account_id (required)
+ * @param string $request_id (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAsyncBulkLookup'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return \GuzzleHttp\Psr7\Request
+ */
+ public function getAsyncBulkLookupRequest(
+ string $account_id,
+ string $request_id,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['getAsyncBulkLookup'][0]
+ ): Request
+ {
+ // verify the required parameter 'account_id' is set
+ if ($account_id === null || (is_array($account_id) && count($account_id) === 0)) {
+ throw new InvalidArgumentException(
+ 'Missing the required parameter $account_id when calling getAsyncBulkLookup'
+ );
+ }
+ // verify the required parameter 'request_id' is set
+ if ($request_id === null || (is_array($request_id) && count($request_id) === 0)) {
+ throw new InvalidArgumentException(
+ 'Missing the required parameter $request_id when calling getAsyncBulkLookup'
+ );
+ }
+
+ $resourcePath = '/accounts/{accountId}/phoneNumberLookup/bulk/{requestId}';
+ $queryParams = [];
+ $headerParams = [];
+ $httpBody = '';
+ $multipart = false;
+
+
+
+ // path params
+ if ($account_id !== null) {
+ $resourcePath = str_replace(
+ '{accountId}',
+ ObjectSerializer::toPathValue($account_id),
+ $resourcePath
+ );
+ }
+ // path params
+ if ($request_id !== null) {
+ $resourcePath = str_replace(
+ '{requestId}',
+ ObjectSerializer::toPathValue($request_id),
+ $resourcePath
+ );
+ }
+
+
+ $headers = $this->headerSelector->selectHeaders(
+ ['application/json', ],
+ $contentType,
+ $multipart
+ );
+
+
+ // this endpoint requires HTTP basic authentication
+ if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) {
+ $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword());
+ }
+
+ // this endpoint requires OAuth (access token)
+ if (!empty($this->config->getAccessToken())) {
+ $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken();
+ }
+
+ $defaultHeaders = [];
+ if ($this->config->getUserAgent()) {
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
+ }
+
+ $headers = array_merge(
+ $defaultHeaders,
+ $headerParams,
+ $headers
+ );
+
+ if ($this->config->getIgnoreOperationHosts()) {
+ $operationHost = $this->config->getHost();
+ } else {
+ # Preserve the original behavior of server indexing.
+ if ($hostIndex === null) {
+ $hostIndex = $this->hostIndex;
+ }
+
+ $hostSettings = $this->getHostSettingsForgetAsyncBulkLookup();
+
+ if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) {
+ throw new InvalidArgumentException("Invalid index {$hostIndex} when selecting the host. Must be less than ".count($hostSettings));
+ }
+ $operationHost = Configuration::getHostString($hostSettings, $hostIndex, $variables);
+ }
+ $query = ObjectSerializer::buildQuery($queryParams);
+ return new Request(
+ 'GET',
+ $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
+ $headers,
+ $httpBody
+ );
+ }
+
+ /**
+ * Returns an array of host settings for Operation getAsyncBulkLookup
+ *
+ * @return array an array of host settings
+ */
+ protected function getHostSettingsForgetAsyncBulkLookup(): array
+ {
+ return [
+ [
+ "url" => "https://api.bandwidth.com/v2",
+ "description" => "Production",
+ ]
+ ];
+ }
+
+ /**
+ * Create http client option
+ *
+ * @throws \RuntimeException on file opening failure
+ * @return array of http client options
+ */
+ protected function createHttpClientOption(): array
+ {
+ $options = [];
+ if ($this->config->getDebug()) {
+ $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a');
+ if (!$options[RequestOptions::DEBUG]) {
+ throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile());
+ }
+ }
+
+ return $options;
+ }
+
+ private function handleResponseWithDataType(
+ string $dataType,
+ RequestInterface $request,
+ ResponseInterface $response,
+ ): array {
+ if (in_array($dataType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($dataType !== 'string') {
+ try {
+ $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR);
+ } catch (\JsonException $exception) {
+ throw new ApiException(
+ sprintf(
+ 'Error JSON decoding server response (%s)',
+ $request->getUri()
+ ),
+ $response->getStatusCode(),
+ $response->getHeaders(),
+ $content
+ );
+ }
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $dataType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ }
+
+ private function responseWithinRangeCode(
+ string $rangeCode,
+ int $statusCode,
+ ): bool {
+ $left = (int) ($rangeCode[0].'00');
+ $right = (int) ($rangeCode[0].'99');
+
+ return $statusCode >= $left && $statusCode <= $right;
+ }
+}
diff --git a/src/Api/RecordingsApi.php b/src/Api/RecordingsApi.php
new file mode 100644
index 0000000..e7ebef6
--- /dev/null
+++ b/src/Api/RecordingsApi.php
@@ -0,0 +1,4721 @@
+ $contentTypes **/
+ public const contentTypes = [
+ 'deleteRecording' => [
+ 'application/json',
+ ],
+ 'deleteRecordingMedia' => [
+ 'application/json',
+ ],
+ 'deleteRecordingTranscription' => [
+ 'application/json',
+ ],
+ 'downloadCallRecording' => [
+ 'application/json',
+ ],
+ 'getCallRecording' => [
+ 'application/json',
+ ],
+ 'getRecordingTranscription' => [
+ 'application/json',
+ ],
+ 'listAccountCallRecordings' => [
+ 'application/json',
+ ],
+ 'listCallRecordings' => [
+ 'application/json',
+ ],
+ 'transcribeCallRecording' => [
+ 'application/json',
+ ],
+ 'updateCallRecordingState' => [
+ 'application/json',
+ ],
+ ];
+
+ /**
+ * @param ClientInterface|null $client
+ * @param Configuration|null $config
+ * @param HeaderSelector|null $selector
+ * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec
+ */
+ public function __construct(
+ ?ClientInterface $client = null,
+ ?Configuration $config = null,
+ ?HeaderSelector $selector = null,
+ int $hostIndex = 0
+ ) {
+ $this->client = $client ?: new Client();
+ $this->config = $config ?: Configuration::getDefaultConfiguration();
+ $this->headerSelector = $selector ?: new HeaderSelector();
+ $this->hostIndex = $hostIndex;
+ }
+
+ /**
+ * Set the host index
+ *
+ * @param int $hostIndex Host index (required)
+ */
+ public function setHostIndex(int $hostIndex): void
+ {
+ $this->hostIndex = $hostIndex;
+ }
+
+ /**
+ * Get the host index
+ *
+ * @return int Host index
+ */
+ public function getHostIndex(): int
+ {
+ return $this->hostIndex;
+ }
+
+ /**
+ * @return Configuration
+ */
+ public function getConfig(): Configuration
+ {
+ return $this->config;
+ }
+
+ /**
+ * Operation deleteRecording
+ *
+ * Delete Recording
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://voice.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $call_id Programmable Voice API Call ID. (required)
+ * @param string $recording_id Programmable Voice API Recording ID. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteRecording'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return \Bandwidth\Model\VoiceApiError|null
+ */
+ public function deleteRecording(
+ string $account_id,
+ string $call_id,
+ string $recording_id,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['deleteRecording'][0]
+ ): ?\Bandwidth\Model\VoiceApiError
+ {
+ list($response) = $this->deleteRecordingWithHttpInfo($account_id, $call_id, $recording_id, $hostIndex, $variables, $contentType);
+ return $response;
+ }
+
+ /**
+ * Operation deleteRecordingWithHttpInfo
+ *
+ * Delete Recording
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://voice.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $call_id Programmable Voice API Call ID. (required)
+ * @param string $recording_id Programmable Voice API Recording ID. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteRecording'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return array{0: null, 1: int, 2: array} [response data, HTTP status code, HTTP response headers]
+ */
+ public function deleteRecordingWithHttpInfo(
+ string $account_id,
+ string $call_id,
+ string $recording_id,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['deleteRecording'][0]
+ ): array
+ {
+ $request = $this->deleteRecordingRequest($account_id, $call_id, $recording_id, $hostIndex, $variables, $contentType);
+
+ try {
+ $options = $this->createHttpClientOption();
+ try {
+ $response = $this->client->send($request, $options);
+ } catch (RequestException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
+ $e->getResponse() ? (string) $e->getResponse()->getBody() : null
+ );
+ } catch (ConnectException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ null,
+ null
+ );
+ }
+
+ $statusCode = $response->getStatusCode();
+
+
+ return [null, $statusCode, $response->getHeaders()];
+ } catch (ApiException $e) {
+ switch ($e->getCode()) {
+ case 400:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 401:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 403:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 404:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 405:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 415:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 429:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 500:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ }
+
+ throw $e;
+ }
+ }
+
+ /**
+ * Operation deleteRecordingAsync
+ *
+ * Delete Recording
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://voice.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $call_id Programmable Voice API Call ID. (required)
+ * @param string $recording_id Programmable Voice API Recording ID. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteRecording'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function deleteRecordingAsync(
+ string $account_id,
+ string $call_id,
+ string $recording_id,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['deleteRecording'][0]
+ ): PromiseInterface
+ {
+ return $this->deleteRecordingAsyncWithHttpInfo($account_id, $call_id, $recording_id, $hostIndex, $variables, $contentType)
+ ->then(
+ function ($response) {
+ return $response[0];
+ }
+ );
+ }
+
+ /**
+ * Operation deleteRecordingAsyncWithHttpInfo
+ *
+ * Delete Recording
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://voice.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $call_id Programmable Voice API Call ID. (required)
+ * @param string $recording_id Programmable Voice API Recording ID. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteRecording'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function deleteRecordingAsyncWithHttpInfo(
+ string $account_id,
+ string $call_id,
+ string $recording_id,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['deleteRecording'][0]
+ ): PromiseInterface
+ {
+ $returnType = '';
+ $request = $this->deleteRecordingRequest($account_id, $call_id, $recording_id, $hostIndex, $variables, $contentType);
+
+ return $this->client
+ ->sendAsync($request, $this->createHttpClientOption())
+ ->then(
+ function ($response) use ($returnType) {
+ return [null, $response->getStatusCode(), $response->getHeaders()];
+ },
+ function ($exception) {
+ $response = $exception->getResponse();
+ $statusCode = $response->getStatusCode();
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ $exception->getRequest()->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+ );
+ }
+
+ /**
+ * Create request for operation 'deleteRecording'
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://voice.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $call_id Programmable Voice API Call ID. (required)
+ * @param string $recording_id Programmable Voice API Recording ID. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteRecording'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return \GuzzleHttp\Psr7\Request
+ */
+ public function deleteRecordingRequest(
+ string $account_id,
+ string $call_id,
+ string $recording_id,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['deleteRecording'][0]
+ ): Request
+ {
+ // verify the required parameter 'account_id' is set
+ if ($account_id === null || (is_array($account_id) && count($account_id) === 0)) {
+ throw new InvalidArgumentException(
+ 'Missing the required parameter $account_id when calling deleteRecording'
+ );
+ }
+ // verify the required parameter 'call_id' is set
+ if ($call_id === null || (is_array($call_id) && count($call_id) === 0)) {
+ throw new InvalidArgumentException(
+ 'Missing the required parameter $call_id when calling deleteRecording'
+ );
+ }
+ // verify the required parameter 'recording_id' is set
+ if ($recording_id === null || (is_array($recording_id) && count($recording_id) === 0)) {
+ throw new InvalidArgumentException(
+ 'Missing the required parameter $recording_id when calling deleteRecording'
+ );
+ }
+
+ $resourcePath = '/accounts/{accountId}/calls/{callId}/recordings/{recordingId}';
+ $queryParams = [];
+ $headerParams = [];
+ $httpBody = '';
+ $multipart = false;
+
+
+
+ // path params
+ if ($account_id !== null) {
+ $resourcePath = str_replace(
+ '{accountId}',
+ ObjectSerializer::toPathValue($account_id),
+ $resourcePath
+ );
+ }
+ // path params
+ if ($call_id !== null) {
+ $resourcePath = str_replace(
+ '{callId}',
+ ObjectSerializer::toPathValue($call_id),
+ $resourcePath
+ );
+ }
+ // path params
+ if ($recording_id !== null) {
+ $resourcePath = str_replace(
+ '{recordingId}',
+ ObjectSerializer::toPathValue($recording_id),
+ $resourcePath
+ );
+ }
+
+
+ $headers = $this->headerSelector->selectHeaders(
+ ['application/json', ],
+ $contentType,
+ $multipart
+ );
+
+
+ // this endpoint requires HTTP basic authentication
+ if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) {
+ $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword());
+ }
+
+ // this endpoint requires OAuth (access token)
+ if (!empty($this->config->getAccessToken())) {
+ $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken();
+ }
+
+ $defaultHeaders = [];
+ if ($this->config->getUserAgent()) {
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
+ }
+
+ $headers = array_merge(
+ $defaultHeaders,
+ $headerParams,
+ $headers
+ );
+
+ if ($this->config->getIgnoreOperationHosts()) {
+ $operationHost = $this->config->getHost();
+ } else {
+ # Preserve the original behavior of server indexing.
+ if ($hostIndex === null) {
+ $hostIndex = $this->hostIndex;
+ }
+
+ $hostSettings = $this->getHostSettingsFordeleteRecording();
+
+ if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) {
+ throw new InvalidArgumentException("Invalid index {$hostIndex} when selecting the host. Must be less than ".count($hostSettings));
+ }
+ $operationHost = Configuration::getHostString($hostSettings, $hostIndex, $variables);
+ }
+ $query = ObjectSerializer::buildQuery($queryParams);
+ return new Request(
+ 'DELETE',
+ $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
+ $headers,
+ $httpBody
+ );
+ }
+
+ /**
+ * Returns an array of host settings for Operation deleteRecording
+ *
+ * @return array an array of host settings
+ */
+ protected function getHostSettingsFordeleteRecording(): array
+ {
+ return [
+ [
+ "url" => "https://voice.bandwidth.com/api/v2",
+ "description" => "Production",
+ ]
+ ];
+ }
+
+ /**
+ * Operation deleteRecordingMedia
+ *
+ * Delete Recording Media
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://voice.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $call_id Programmable Voice API Call ID. (required)
+ * @param string $recording_id Programmable Voice API Recording ID. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteRecordingMedia'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return \Bandwidth\Model\VoiceApiError|null
+ */
+ public function deleteRecordingMedia(
+ string $account_id,
+ string $call_id,
+ string $recording_id,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['deleteRecordingMedia'][0]
+ ): ?\Bandwidth\Model\VoiceApiError
+ {
+ list($response) = $this->deleteRecordingMediaWithHttpInfo($account_id, $call_id, $recording_id, $hostIndex, $variables, $contentType);
+ return $response;
+ }
+
+ /**
+ * Operation deleteRecordingMediaWithHttpInfo
+ *
+ * Delete Recording Media
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://voice.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $call_id Programmable Voice API Call ID. (required)
+ * @param string $recording_id Programmable Voice API Recording ID. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteRecordingMedia'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return array{0: null, 1: int, 2: array} [response data, HTTP status code, HTTP response headers]
+ */
+ public function deleteRecordingMediaWithHttpInfo(
+ string $account_id,
+ string $call_id,
+ string $recording_id,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['deleteRecordingMedia'][0]
+ ): array
+ {
+ $request = $this->deleteRecordingMediaRequest($account_id, $call_id, $recording_id, $hostIndex, $variables, $contentType);
+
+ try {
+ $options = $this->createHttpClientOption();
+ try {
+ $response = $this->client->send($request, $options);
+ } catch (RequestException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
+ $e->getResponse() ? (string) $e->getResponse()->getBody() : null
+ );
+ } catch (ConnectException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ null,
+ null
+ );
+ }
+
+ $statusCode = $response->getStatusCode();
+
+
+ return [null, $statusCode, $response->getHeaders()];
+ } catch (ApiException $e) {
+ switch ($e->getCode()) {
+ case 400:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 401:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 403:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 404:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 405:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 415:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 429:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 500:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ }
+
+ throw $e;
+ }
+ }
+
+ /**
+ * Operation deleteRecordingMediaAsync
+ *
+ * Delete Recording Media
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://voice.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $call_id Programmable Voice API Call ID. (required)
+ * @param string $recording_id Programmable Voice API Recording ID. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteRecordingMedia'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function deleteRecordingMediaAsync(
+ string $account_id,
+ string $call_id,
+ string $recording_id,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['deleteRecordingMedia'][0]
+ ): PromiseInterface
+ {
+ return $this->deleteRecordingMediaAsyncWithHttpInfo($account_id, $call_id, $recording_id, $hostIndex, $variables, $contentType)
+ ->then(
+ function ($response) {
+ return $response[0];
+ }
+ );
+ }
+
+ /**
+ * Operation deleteRecordingMediaAsyncWithHttpInfo
+ *
+ * Delete Recording Media
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://voice.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $call_id Programmable Voice API Call ID. (required)
+ * @param string $recording_id Programmable Voice API Recording ID. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteRecordingMedia'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function deleteRecordingMediaAsyncWithHttpInfo(
+ string $account_id,
+ string $call_id,
+ string $recording_id,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['deleteRecordingMedia'][0]
+ ): PromiseInterface
+ {
+ $returnType = '';
+ $request = $this->deleteRecordingMediaRequest($account_id, $call_id, $recording_id, $hostIndex, $variables, $contentType);
+
+ return $this->client
+ ->sendAsync($request, $this->createHttpClientOption())
+ ->then(
+ function ($response) use ($returnType) {
+ return [null, $response->getStatusCode(), $response->getHeaders()];
+ },
+ function ($exception) {
+ $response = $exception->getResponse();
+ $statusCode = $response->getStatusCode();
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ $exception->getRequest()->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+ );
+ }
+
+ /**
+ * Create request for operation 'deleteRecordingMedia'
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://voice.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $call_id Programmable Voice API Call ID. (required)
+ * @param string $recording_id Programmable Voice API Recording ID. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteRecordingMedia'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return \GuzzleHttp\Psr7\Request
+ */
+ public function deleteRecordingMediaRequest(
+ string $account_id,
+ string $call_id,
+ string $recording_id,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['deleteRecordingMedia'][0]
+ ): Request
+ {
+ // verify the required parameter 'account_id' is set
+ if ($account_id === null || (is_array($account_id) && count($account_id) === 0)) {
+ throw new InvalidArgumentException(
+ 'Missing the required parameter $account_id when calling deleteRecordingMedia'
+ );
+ }
+ // verify the required parameter 'call_id' is set
+ if ($call_id === null || (is_array($call_id) && count($call_id) === 0)) {
+ throw new InvalidArgumentException(
+ 'Missing the required parameter $call_id when calling deleteRecordingMedia'
+ );
+ }
+ // verify the required parameter 'recording_id' is set
+ if ($recording_id === null || (is_array($recording_id) && count($recording_id) === 0)) {
+ throw new InvalidArgumentException(
+ 'Missing the required parameter $recording_id when calling deleteRecordingMedia'
+ );
+ }
+
+ $resourcePath = '/accounts/{accountId}/calls/{callId}/recordings/{recordingId}/media';
+ $queryParams = [];
+ $headerParams = [];
+ $httpBody = '';
+ $multipart = false;
+
+
+
+ // path params
+ if ($account_id !== null) {
+ $resourcePath = str_replace(
+ '{accountId}',
+ ObjectSerializer::toPathValue($account_id),
+ $resourcePath
+ );
+ }
+ // path params
+ if ($call_id !== null) {
+ $resourcePath = str_replace(
+ '{callId}',
+ ObjectSerializer::toPathValue($call_id),
+ $resourcePath
+ );
+ }
+ // path params
+ if ($recording_id !== null) {
+ $resourcePath = str_replace(
+ '{recordingId}',
+ ObjectSerializer::toPathValue($recording_id),
+ $resourcePath
+ );
+ }
+
+
+ $headers = $this->headerSelector->selectHeaders(
+ ['application/json', ],
+ $contentType,
+ $multipart
+ );
+
+
+ // this endpoint requires HTTP basic authentication
+ if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) {
+ $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword());
+ }
+
+ // this endpoint requires OAuth (access token)
+ if (!empty($this->config->getAccessToken())) {
+ $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken();
+ }
+
+ $defaultHeaders = [];
+ if ($this->config->getUserAgent()) {
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
+ }
+
+ $headers = array_merge(
+ $defaultHeaders,
+ $headerParams,
+ $headers
+ );
+
+ if ($this->config->getIgnoreOperationHosts()) {
+ $operationHost = $this->config->getHost();
+ } else {
+ # Preserve the original behavior of server indexing.
+ if ($hostIndex === null) {
+ $hostIndex = $this->hostIndex;
+ }
+
+ $hostSettings = $this->getHostSettingsFordeleteRecordingMedia();
+
+ if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) {
+ throw new InvalidArgumentException("Invalid index {$hostIndex} when selecting the host. Must be less than ".count($hostSettings));
+ }
+ $operationHost = Configuration::getHostString($hostSettings, $hostIndex, $variables);
+ }
+ $query = ObjectSerializer::buildQuery($queryParams);
+ return new Request(
+ 'DELETE',
+ $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
+ $headers,
+ $httpBody
+ );
+ }
+
+ /**
+ * Returns an array of host settings for Operation deleteRecordingMedia
+ *
+ * @return array an array of host settings
+ */
+ protected function getHostSettingsFordeleteRecordingMedia(): array
+ {
+ return [
+ [
+ "url" => "https://voice.bandwidth.com/api/v2",
+ "description" => "Production",
+ ]
+ ];
+ }
+
+ /**
+ * Operation deleteRecordingTranscription
+ *
+ * Delete Transcription
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://voice.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $call_id Programmable Voice API Call ID. (required)
+ * @param string $recording_id Programmable Voice API Recording ID. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteRecordingTranscription'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return \Bandwidth\Model\VoiceApiError|null
+ */
+ public function deleteRecordingTranscription(
+ string $account_id,
+ string $call_id,
+ string $recording_id,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['deleteRecordingTranscription'][0]
+ ): ?\Bandwidth\Model\VoiceApiError
+ {
+ list($response) = $this->deleteRecordingTranscriptionWithHttpInfo($account_id, $call_id, $recording_id, $hostIndex, $variables, $contentType);
+ return $response;
+ }
+
+ /**
+ * Operation deleteRecordingTranscriptionWithHttpInfo
+ *
+ * Delete Transcription
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://voice.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $call_id Programmable Voice API Call ID. (required)
+ * @param string $recording_id Programmable Voice API Recording ID. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteRecordingTranscription'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return array{0: null, 1: int, 2: array} [response data, HTTP status code, HTTP response headers]
+ */
+ public function deleteRecordingTranscriptionWithHttpInfo(
+ string $account_id,
+ string $call_id,
+ string $recording_id,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['deleteRecordingTranscription'][0]
+ ): array
+ {
+ $request = $this->deleteRecordingTranscriptionRequest($account_id, $call_id, $recording_id, $hostIndex, $variables, $contentType);
+
+ try {
+ $options = $this->createHttpClientOption();
+ try {
+ $response = $this->client->send($request, $options);
+ } catch (RequestException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
+ $e->getResponse() ? (string) $e->getResponse()->getBody() : null
+ );
+ } catch (ConnectException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ null,
+ null
+ );
+ }
+
+ $statusCode = $response->getStatusCode();
+
+
+ return [null, $statusCode, $response->getHeaders()];
+ } catch (ApiException $e) {
+ switch ($e->getCode()) {
+ case 400:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 401:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 403:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 404:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 405:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 415:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 429:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 500:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ }
+
+ throw $e;
+ }
+ }
+
+ /**
+ * Operation deleteRecordingTranscriptionAsync
+ *
+ * Delete Transcription
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://voice.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $call_id Programmable Voice API Call ID. (required)
+ * @param string $recording_id Programmable Voice API Recording ID. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteRecordingTranscription'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function deleteRecordingTranscriptionAsync(
+ string $account_id,
+ string $call_id,
+ string $recording_id,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['deleteRecordingTranscription'][0]
+ ): PromiseInterface
+ {
+ return $this->deleteRecordingTranscriptionAsyncWithHttpInfo($account_id, $call_id, $recording_id, $hostIndex, $variables, $contentType)
+ ->then(
+ function ($response) {
+ return $response[0];
+ }
+ );
+ }
+
+ /**
+ * Operation deleteRecordingTranscriptionAsyncWithHttpInfo
+ *
+ * Delete Transcription
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://voice.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $call_id Programmable Voice API Call ID. (required)
+ * @param string $recording_id Programmable Voice API Recording ID. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteRecordingTranscription'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function deleteRecordingTranscriptionAsyncWithHttpInfo(
+ string $account_id,
+ string $call_id,
+ string $recording_id,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['deleteRecordingTranscription'][0]
+ ): PromiseInterface
+ {
+ $returnType = '';
+ $request = $this->deleteRecordingTranscriptionRequest($account_id, $call_id, $recording_id, $hostIndex, $variables, $contentType);
+
+ return $this->client
+ ->sendAsync($request, $this->createHttpClientOption())
+ ->then(
+ function ($response) use ($returnType) {
+ return [null, $response->getStatusCode(), $response->getHeaders()];
+ },
+ function ($exception) {
+ $response = $exception->getResponse();
+ $statusCode = $response->getStatusCode();
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ $exception->getRequest()->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+ );
+ }
+
+ /**
+ * Create request for operation 'deleteRecordingTranscription'
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://voice.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $call_id Programmable Voice API Call ID. (required)
+ * @param string $recording_id Programmable Voice API Recording ID. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteRecordingTranscription'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return \GuzzleHttp\Psr7\Request
+ */
+ public function deleteRecordingTranscriptionRequest(
+ string $account_id,
+ string $call_id,
+ string $recording_id,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['deleteRecordingTranscription'][0]
+ ): Request
+ {
+ // verify the required parameter 'account_id' is set
+ if ($account_id === null || (is_array($account_id) && count($account_id) === 0)) {
+ throw new InvalidArgumentException(
+ 'Missing the required parameter $account_id when calling deleteRecordingTranscription'
+ );
+ }
+ // verify the required parameter 'call_id' is set
+ if ($call_id === null || (is_array($call_id) && count($call_id) === 0)) {
+ throw new InvalidArgumentException(
+ 'Missing the required parameter $call_id when calling deleteRecordingTranscription'
+ );
+ }
+ // verify the required parameter 'recording_id' is set
+ if ($recording_id === null || (is_array($recording_id) && count($recording_id) === 0)) {
+ throw new InvalidArgumentException(
+ 'Missing the required parameter $recording_id when calling deleteRecordingTranscription'
+ );
+ }
+
+ $resourcePath = '/accounts/{accountId}/calls/{callId}/recordings/{recordingId}/transcription';
+ $queryParams = [];
+ $headerParams = [];
+ $httpBody = '';
+ $multipart = false;
+
+
+
+ // path params
+ if ($account_id !== null) {
+ $resourcePath = str_replace(
+ '{accountId}',
+ ObjectSerializer::toPathValue($account_id),
+ $resourcePath
+ );
+ }
+ // path params
+ if ($call_id !== null) {
+ $resourcePath = str_replace(
+ '{callId}',
+ ObjectSerializer::toPathValue($call_id),
+ $resourcePath
+ );
+ }
+ // path params
+ if ($recording_id !== null) {
+ $resourcePath = str_replace(
+ '{recordingId}',
+ ObjectSerializer::toPathValue($recording_id),
+ $resourcePath
+ );
+ }
+
+
+ $headers = $this->headerSelector->selectHeaders(
+ ['application/json', ],
+ $contentType,
+ $multipart
+ );
+
+
+ // this endpoint requires HTTP basic authentication
+ if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) {
+ $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword());
+ }
+
+ // this endpoint requires OAuth (access token)
+ if (!empty($this->config->getAccessToken())) {
+ $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken();
+ }
+
+ $defaultHeaders = [];
+ if ($this->config->getUserAgent()) {
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
+ }
+
+ $headers = array_merge(
+ $defaultHeaders,
+ $headerParams,
+ $headers
+ );
+
+ if ($this->config->getIgnoreOperationHosts()) {
+ $operationHost = $this->config->getHost();
+ } else {
+ # Preserve the original behavior of server indexing.
+ if ($hostIndex === null) {
+ $hostIndex = $this->hostIndex;
+ }
+
+ $hostSettings = $this->getHostSettingsFordeleteRecordingTranscription();
+
+ if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) {
+ throw new InvalidArgumentException("Invalid index {$hostIndex} when selecting the host. Must be less than ".count($hostSettings));
+ }
+ $operationHost = Configuration::getHostString($hostSettings, $hostIndex, $variables);
+ }
+ $query = ObjectSerializer::buildQuery($queryParams);
+ return new Request(
+ 'DELETE',
+ $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
+ $headers,
+ $httpBody
+ );
+ }
+
+ /**
+ * Returns an array of host settings for Operation deleteRecordingTranscription
+ *
+ * @return array an array of host settings
+ */
+ protected function getHostSettingsFordeleteRecordingTranscription(): array
+ {
+ return [
+ [
+ "url" => "https://voice.bandwidth.com/api/v2",
+ "description" => "Production",
+ ]
+ ];
+ }
+
+ /**
+ * Operation downloadCallRecording
+ *
+ * Download Recording
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://voice.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $call_id Programmable Voice API Call ID. (required)
+ * @param string $recording_id Programmable Voice API Recording ID. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['downloadCallRecording'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return \SplFileObject|\Bandwidth\Model\VoiceApiError
+ */
+ public function downloadCallRecording(
+ string $account_id,
+ string $call_id,
+ string $recording_id,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['downloadCallRecording'][0]
+ ): \SplFileObject|\Bandwidth\Model\VoiceApiError
+ {
+ list($response) = $this->downloadCallRecordingWithHttpInfo($account_id, $call_id, $recording_id, $hostIndex, $variables, $contentType);
+ return $response;
+ }
+
+ /**
+ * Operation downloadCallRecordingWithHttpInfo
+ *
+ * Download Recording
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://voice.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $call_id Programmable Voice API Call ID. (required)
+ * @param string $recording_id Programmable Voice API Recording ID. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['downloadCallRecording'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return array{0: \SplFileObject|\Bandwidth\Model\VoiceApiError, 1: int, 2: array} [response data, HTTP status code, HTTP response headers]
+ */
+ public function downloadCallRecordingWithHttpInfo(
+ string $account_id,
+ string $call_id,
+ string $recording_id,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['downloadCallRecording'][0]
+ ): array
+ {
+ $request = $this->downloadCallRecordingRequest($account_id, $call_id, $recording_id, $hostIndex, $variables, $contentType);
+
+ try {
+ $options = $this->createHttpClientOption();
+ try {
+ $response = $this->client->send($request, $options);
+ } catch (RequestException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
+ $e->getResponse() ? (string) $e->getResponse()->getBody() : null
+ );
+ } catch (ConnectException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ null,
+ null
+ );
+ }
+
+ $statusCode = $response->getStatusCode();
+
+ switch($statusCode) {
+ case 200:
+ return $this->handleResponseWithDataType(
+ '\SplFileObject',
+ $request,
+ $response,
+ );
+ case 400:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\VoiceApiError',
+ $request,
+ $response,
+ );
+ case 401:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\VoiceApiError',
+ $request,
+ $response,
+ );
+ case 403:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\VoiceApiError',
+ $request,
+ $response,
+ );
+ case 404:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\VoiceApiError',
+ $request,
+ $response,
+ );
+ case 405:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\VoiceApiError',
+ $request,
+ $response,
+ );
+ case 415:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\VoiceApiError',
+ $request,
+ $response,
+ );
+ case 429:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\VoiceApiError',
+ $request,
+ $response,
+ );
+ case 500:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\VoiceApiError',
+ $request,
+ $response,
+ );
+ }
+
+ if ($statusCode < 200 || $statusCode > 299) {
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ (string) $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+
+ return $this->handleResponseWithDataType(
+ '\SplFileObject',
+ $request,
+ $response,
+ );
+ } catch (ApiException $e) {
+ switch ($e->getCode()) {
+ case 200:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\SplFileObject',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 400:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 401:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 403:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 404:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 405:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 415:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 429:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 500:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ }
+
+ throw $e;
+ }
+ }
+
+ /**
+ * Operation downloadCallRecordingAsync
+ *
+ * Download Recording
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://voice.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $call_id Programmable Voice API Call ID. (required)
+ * @param string $recording_id Programmable Voice API Recording ID. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['downloadCallRecording'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function downloadCallRecordingAsync(
+ string $account_id,
+ string $call_id,
+ string $recording_id,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['downloadCallRecording'][0]
+ ): PromiseInterface
+ {
+ return $this->downloadCallRecordingAsyncWithHttpInfo($account_id, $call_id, $recording_id, $hostIndex, $variables, $contentType)
+ ->then(
+ function ($response) {
+ return $response[0];
+ }
+ );
+ }
+
+ /**
+ * Operation downloadCallRecordingAsyncWithHttpInfo
+ *
+ * Download Recording
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://voice.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $call_id Programmable Voice API Call ID. (required)
+ * @param string $recording_id Programmable Voice API Recording ID. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['downloadCallRecording'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function downloadCallRecordingAsyncWithHttpInfo(
+ string $account_id,
+ string $call_id,
+ string $recording_id,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['downloadCallRecording'][0]
+ ): PromiseInterface
+ {
+ $returnType = '\SplFileObject';
+ $request = $this->downloadCallRecordingRequest($account_id, $call_id, $recording_id, $hostIndex, $variables, $contentType);
+
+ return $this->client
+ ->sendAsync($request, $this->createHttpClientOption())
+ ->then(
+ function ($response) use ($returnType) {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ },
+ function ($exception) {
+ $response = $exception->getResponse();
+ $statusCode = $response->getStatusCode();
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ $exception->getRequest()->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+ );
+ }
+
+ /**
+ * Create request for operation 'downloadCallRecording'
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://voice.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $call_id Programmable Voice API Call ID. (required)
+ * @param string $recording_id Programmable Voice API Recording ID. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['downloadCallRecording'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return \GuzzleHttp\Psr7\Request
+ */
+ public function downloadCallRecordingRequest(
+ string $account_id,
+ string $call_id,
+ string $recording_id,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['downloadCallRecording'][0]
+ ): Request
+ {
+ // verify the required parameter 'account_id' is set
+ if ($account_id === null || (is_array($account_id) && count($account_id) === 0)) {
+ throw new InvalidArgumentException(
+ 'Missing the required parameter $account_id when calling downloadCallRecording'
+ );
+ }
+ // verify the required parameter 'call_id' is set
+ if ($call_id === null || (is_array($call_id) && count($call_id) === 0)) {
+ throw new InvalidArgumentException(
+ 'Missing the required parameter $call_id when calling downloadCallRecording'
+ );
+ }
+ // verify the required parameter 'recording_id' is set
+ if ($recording_id === null || (is_array($recording_id) && count($recording_id) === 0)) {
+ throw new InvalidArgumentException(
+ 'Missing the required parameter $recording_id when calling downloadCallRecording'
+ );
+ }
+
+ $resourcePath = '/accounts/{accountId}/calls/{callId}/recordings/{recordingId}/media';
+ $queryParams = [];
+ $headerParams = [];
+ $httpBody = '';
+ $multipart = false;
+
+
+
+ // path params
+ if ($account_id !== null) {
+ $resourcePath = str_replace(
+ '{accountId}',
+ ObjectSerializer::toPathValue($account_id),
+ $resourcePath
+ );
+ }
+ // path params
+ if ($call_id !== null) {
+ $resourcePath = str_replace(
+ '{callId}',
+ ObjectSerializer::toPathValue($call_id),
+ $resourcePath
+ );
+ }
+ // path params
+ if ($recording_id !== null) {
+ $resourcePath = str_replace(
+ '{recordingId}',
+ ObjectSerializer::toPathValue($recording_id),
+ $resourcePath
+ );
+ }
+
+
+ $headers = $this->headerSelector->selectHeaders(
+ ['audio/vnd.wave', 'audio/mpeg', 'application/json', ],
+ $contentType,
+ $multipart
+ );
+
+
+ // this endpoint requires HTTP basic authentication
+ if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) {
+ $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword());
+ }
+
+ // this endpoint requires OAuth (access token)
+ if (!empty($this->config->getAccessToken())) {
+ $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken();
+ }
+
+ $defaultHeaders = [];
+ if ($this->config->getUserAgent()) {
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
+ }
+
+ $headers = array_merge(
+ $defaultHeaders,
+ $headerParams,
+ $headers
+ );
+
+ if ($this->config->getIgnoreOperationHosts()) {
+ $operationHost = $this->config->getHost();
+ } else {
+ # Preserve the original behavior of server indexing.
+ if ($hostIndex === null) {
+ $hostIndex = $this->hostIndex;
+ }
+
+ $hostSettings = $this->getHostSettingsFordownloadCallRecording();
+
+ if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) {
+ throw new InvalidArgumentException("Invalid index {$hostIndex} when selecting the host. Must be less than ".count($hostSettings));
+ }
+ $operationHost = Configuration::getHostString($hostSettings, $hostIndex, $variables);
+ }
+ $query = ObjectSerializer::buildQuery($queryParams);
+ return new Request(
+ 'GET',
+ $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
+ $headers,
+ $httpBody
+ );
+ }
+
+ /**
+ * Returns an array of host settings for Operation downloadCallRecording
+ *
+ * @return array an array of host settings
+ */
+ protected function getHostSettingsFordownloadCallRecording(): array
+ {
+ return [
+ [
+ "url" => "https://voice.bandwidth.com/api/v2",
+ "description" => "Production",
+ ]
+ ];
+ }
+
+ /**
+ * Operation getCallRecording
+ *
+ * Get Call Recording
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://voice.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $call_id Programmable Voice API Call ID. (required)
+ * @param string $recording_id Programmable Voice API Recording ID. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getCallRecording'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return \Bandwidth\Model\CallRecordingMetadata|\Bandwidth\Model\VoiceApiError
+ */
+ public function getCallRecording(
+ string $account_id,
+ string $call_id,
+ string $recording_id,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['getCallRecording'][0]
+ ): \Bandwidth\Model\CallRecordingMetadata|\Bandwidth\Model\VoiceApiError
+ {
+ list($response) = $this->getCallRecordingWithHttpInfo($account_id, $call_id, $recording_id, $hostIndex, $variables, $contentType);
+ return $response;
+ }
+
+ /**
+ * Operation getCallRecordingWithHttpInfo
+ *
+ * Get Call Recording
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://voice.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $call_id Programmable Voice API Call ID. (required)
+ * @param string $recording_id Programmable Voice API Recording ID. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getCallRecording'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return array{0: \Bandwidth\Model\CallRecordingMetadata|\Bandwidth\Model\VoiceApiError, 1: int, 2: array} [response data, HTTP status code, HTTP response headers]
+ */
+ public function getCallRecordingWithHttpInfo(
+ string $account_id,
+ string $call_id,
+ string $recording_id,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['getCallRecording'][0]
+ ): array
+ {
+ $request = $this->getCallRecordingRequest($account_id, $call_id, $recording_id, $hostIndex, $variables, $contentType);
+
+ try {
+ $options = $this->createHttpClientOption();
+ try {
+ $response = $this->client->send($request, $options);
+ } catch (RequestException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
+ $e->getResponse() ? (string) $e->getResponse()->getBody() : null
+ );
+ } catch (ConnectException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ null,
+ null
+ );
+ }
+
+ $statusCode = $response->getStatusCode();
+
+ switch($statusCode) {
+ case 200:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\CallRecordingMetadata',
+ $request,
+ $response,
+ );
+ case 400:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\VoiceApiError',
+ $request,
+ $response,
+ );
+ case 401:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\VoiceApiError',
+ $request,
+ $response,
+ );
+ case 403:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\VoiceApiError',
+ $request,
+ $response,
+ );
+ case 404:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\VoiceApiError',
+ $request,
+ $response,
+ );
+ case 405:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\VoiceApiError',
+ $request,
+ $response,
+ );
+ case 415:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\VoiceApiError',
+ $request,
+ $response,
+ );
+ case 429:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\VoiceApiError',
+ $request,
+ $response,
+ );
+ case 500:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\VoiceApiError',
+ $request,
+ $response,
+ );
+ }
+
+ if ($statusCode < 200 || $statusCode > 299) {
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ (string) $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\CallRecordingMetadata',
+ $request,
+ $response,
+ );
+ } catch (ApiException $e) {
+ switch ($e->getCode()) {
+ case 200:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\CallRecordingMetadata',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 400:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 401:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 403:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 404:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 405:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 415:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 429:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 500:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ }
+
+ throw $e;
+ }
+ }
+
+ /**
+ * Operation getCallRecordingAsync
+ *
+ * Get Call Recording
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://voice.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $call_id Programmable Voice API Call ID. (required)
+ * @param string $recording_id Programmable Voice API Recording ID. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getCallRecording'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function getCallRecordingAsync(
+ string $account_id,
+ string $call_id,
+ string $recording_id,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['getCallRecording'][0]
+ ): PromiseInterface
+ {
+ return $this->getCallRecordingAsyncWithHttpInfo($account_id, $call_id, $recording_id, $hostIndex, $variables, $contentType)
+ ->then(
+ function ($response) {
+ return $response[0];
+ }
+ );
+ }
+
+ /**
+ * Operation getCallRecordingAsyncWithHttpInfo
+ *
+ * Get Call Recording
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://voice.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $call_id Programmable Voice API Call ID. (required)
+ * @param string $recording_id Programmable Voice API Recording ID. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getCallRecording'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function getCallRecordingAsyncWithHttpInfo(
+ string $account_id,
+ string $call_id,
+ string $recording_id,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['getCallRecording'][0]
+ ): PromiseInterface
+ {
+ $returnType = '\Bandwidth\Model\CallRecordingMetadata';
+ $request = $this->getCallRecordingRequest($account_id, $call_id, $recording_id, $hostIndex, $variables, $contentType);
+
+ return $this->client
+ ->sendAsync($request, $this->createHttpClientOption())
+ ->then(
+ function ($response) use ($returnType) {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ },
+ function ($exception) {
+ $response = $exception->getResponse();
+ $statusCode = $response->getStatusCode();
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ $exception->getRequest()->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+ );
+ }
+
+ /**
+ * Create request for operation 'getCallRecording'
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://voice.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $call_id Programmable Voice API Call ID. (required)
+ * @param string $recording_id Programmable Voice API Recording ID. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getCallRecording'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return \GuzzleHttp\Psr7\Request
+ */
+ public function getCallRecordingRequest(
+ string $account_id,
+ string $call_id,
+ string $recording_id,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['getCallRecording'][0]
+ ): Request
+ {
+ // verify the required parameter 'account_id' is set
+ if ($account_id === null || (is_array($account_id) && count($account_id) === 0)) {
+ throw new InvalidArgumentException(
+ 'Missing the required parameter $account_id when calling getCallRecording'
+ );
+ }
+ // verify the required parameter 'call_id' is set
+ if ($call_id === null || (is_array($call_id) && count($call_id) === 0)) {
+ throw new InvalidArgumentException(
+ 'Missing the required parameter $call_id when calling getCallRecording'
+ );
+ }
+ // verify the required parameter 'recording_id' is set
+ if ($recording_id === null || (is_array($recording_id) && count($recording_id) === 0)) {
+ throw new InvalidArgumentException(
+ 'Missing the required parameter $recording_id when calling getCallRecording'
+ );
+ }
+
+ $resourcePath = '/accounts/{accountId}/calls/{callId}/recordings/{recordingId}';
+ $queryParams = [];
+ $headerParams = [];
+ $httpBody = '';
+ $multipart = false;
+
+
+
+ // path params
+ if ($account_id !== null) {
+ $resourcePath = str_replace(
+ '{accountId}',
+ ObjectSerializer::toPathValue($account_id),
+ $resourcePath
+ );
+ }
+ // path params
+ if ($call_id !== null) {
+ $resourcePath = str_replace(
+ '{callId}',
+ ObjectSerializer::toPathValue($call_id),
+ $resourcePath
+ );
+ }
+ // path params
+ if ($recording_id !== null) {
+ $resourcePath = str_replace(
+ '{recordingId}',
+ ObjectSerializer::toPathValue($recording_id),
+ $resourcePath
+ );
+ }
+
+
+ $headers = $this->headerSelector->selectHeaders(
+ ['application/json', ],
+ $contentType,
+ $multipart
+ );
+
+
+ // this endpoint requires HTTP basic authentication
+ if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) {
+ $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword());
+ }
+
+ // this endpoint requires OAuth (access token)
+ if (!empty($this->config->getAccessToken())) {
+ $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken();
+ }
+
+ $defaultHeaders = [];
+ if ($this->config->getUserAgent()) {
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
+ }
+
+ $headers = array_merge(
+ $defaultHeaders,
+ $headerParams,
+ $headers
+ );
+
+ if ($this->config->getIgnoreOperationHosts()) {
+ $operationHost = $this->config->getHost();
+ } else {
+ # Preserve the original behavior of server indexing.
+ if ($hostIndex === null) {
+ $hostIndex = $this->hostIndex;
+ }
+
+ $hostSettings = $this->getHostSettingsForgetCallRecording();
+
+ if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) {
+ throw new InvalidArgumentException("Invalid index {$hostIndex} when selecting the host. Must be less than ".count($hostSettings));
+ }
+ $operationHost = Configuration::getHostString($hostSettings, $hostIndex, $variables);
+ }
+ $query = ObjectSerializer::buildQuery($queryParams);
+ return new Request(
+ 'GET',
+ $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
+ $headers,
+ $httpBody
+ );
+ }
+
+ /**
+ * Returns an array of host settings for Operation getCallRecording
+ *
+ * @return array an array of host settings
+ */
+ protected function getHostSettingsForgetCallRecording(): array
+ {
+ return [
+ [
+ "url" => "https://voice.bandwidth.com/api/v2",
+ "description" => "Production",
+ ]
+ ];
+ }
+
+ /**
+ * Operation getRecordingTranscription
+ *
+ * Get Transcription
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://voice.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $call_id Programmable Voice API Call ID. (required)
+ * @param string $recording_id Programmable Voice API Recording ID. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getRecordingTranscription'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return \Bandwidth\Model\RecordingTranscriptions|\Bandwidth\Model\VoiceApiError
+ */
+ public function getRecordingTranscription(
+ string $account_id,
+ string $call_id,
+ string $recording_id,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['getRecordingTranscription'][0]
+ ): \Bandwidth\Model\RecordingTranscriptions|\Bandwidth\Model\VoiceApiError
+ {
+ list($response) = $this->getRecordingTranscriptionWithHttpInfo($account_id, $call_id, $recording_id, $hostIndex, $variables, $contentType);
+ return $response;
+ }
+
+ /**
+ * Operation getRecordingTranscriptionWithHttpInfo
+ *
+ * Get Transcription
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://voice.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $call_id Programmable Voice API Call ID. (required)
+ * @param string $recording_id Programmable Voice API Recording ID. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getRecordingTranscription'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return array{0: \Bandwidth\Model\RecordingTranscriptions|\Bandwidth\Model\VoiceApiError, 1: int, 2: array} [response data, HTTP status code, HTTP response headers]
+ */
+ public function getRecordingTranscriptionWithHttpInfo(
+ string $account_id,
+ string $call_id,
+ string $recording_id,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['getRecordingTranscription'][0]
+ ): array
+ {
+ $request = $this->getRecordingTranscriptionRequest($account_id, $call_id, $recording_id, $hostIndex, $variables, $contentType);
+
+ try {
+ $options = $this->createHttpClientOption();
+ try {
+ $response = $this->client->send($request, $options);
+ } catch (RequestException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
+ $e->getResponse() ? (string) $e->getResponse()->getBody() : null
+ );
+ } catch (ConnectException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ null,
+ null
+ );
+ }
+
+ $statusCode = $response->getStatusCode();
+
+ switch($statusCode) {
+ case 200:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\RecordingTranscriptions',
+ $request,
+ $response,
+ );
+ case 400:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\VoiceApiError',
+ $request,
+ $response,
+ );
+ case 401:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\VoiceApiError',
+ $request,
+ $response,
+ );
+ case 403:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\VoiceApiError',
+ $request,
+ $response,
+ );
+ case 404:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\VoiceApiError',
+ $request,
+ $response,
+ );
+ case 405:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\VoiceApiError',
+ $request,
+ $response,
+ );
+ case 415:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\VoiceApiError',
+ $request,
+ $response,
+ );
+ case 429:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\VoiceApiError',
+ $request,
+ $response,
+ );
+ case 500:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\VoiceApiError',
+ $request,
+ $response,
+ );
+ }
+
+ if ($statusCode < 200 || $statusCode > 299) {
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ (string) $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\RecordingTranscriptions',
+ $request,
+ $response,
+ );
+ } catch (ApiException $e) {
+ switch ($e->getCode()) {
+ case 200:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\RecordingTranscriptions',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 400:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 401:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 403:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 404:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 405:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 415:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 429:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 500:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ }
+
+ throw $e;
+ }
+ }
+
+ /**
+ * Operation getRecordingTranscriptionAsync
+ *
+ * Get Transcription
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://voice.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $call_id Programmable Voice API Call ID. (required)
+ * @param string $recording_id Programmable Voice API Recording ID. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getRecordingTranscription'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function getRecordingTranscriptionAsync(
+ string $account_id,
+ string $call_id,
+ string $recording_id,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['getRecordingTranscription'][0]
+ ): PromiseInterface
+ {
+ return $this->getRecordingTranscriptionAsyncWithHttpInfo($account_id, $call_id, $recording_id, $hostIndex, $variables, $contentType)
+ ->then(
+ function ($response) {
+ return $response[0];
+ }
+ );
+ }
+
+ /**
+ * Operation getRecordingTranscriptionAsyncWithHttpInfo
+ *
+ * Get Transcription
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://voice.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $call_id Programmable Voice API Call ID. (required)
+ * @param string $recording_id Programmable Voice API Recording ID. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getRecordingTranscription'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function getRecordingTranscriptionAsyncWithHttpInfo(
+ string $account_id,
+ string $call_id,
+ string $recording_id,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['getRecordingTranscription'][0]
+ ): PromiseInterface
+ {
+ $returnType = '\Bandwidth\Model\RecordingTranscriptions';
+ $request = $this->getRecordingTranscriptionRequest($account_id, $call_id, $recording_id, $hostIndex, $variables, $contentType);
+
+ return $this->client
+ ->sendAsync($request, $this->createHttpClientOption())
+ ->then(
+ function ($response) use ($returnType) {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ },
+ function ($exception) {
+ $response = $exception->getResponse();
+ $statusCode = $response->getStatusCode();
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ $exception->getRequest()->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+ );
+ }
+
+ /**
+ * Create request for operation 'getRecordingTranscription'
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://voice.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $call_id Programmable Voice API Call ID. (required)
+ * @param string $recording_id Programmable Voice API Recording ID. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getRecordingTranscription'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return \GuzzleHttp\Psr7\Request
+ */
+ public function getRecordingTranscriptionRequest(
+ string $account_id,
+ string $call_id,
+ string $recording_id,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['getRecordingTranscription'][0]
+ ): Request
+ {
+ // verify the required parameter 'account_id' is set
+ if ($account_id === null || (is_array($account_id) && count($account_id) === 0)) {
+ throw new InvalidArgumentException(
+ 'Missing the required parameter $account_id when calling getRecordingTranscription'
+ );
+ }
+ // verify the required parameter 'call_id' is set
+ if ($call_id === null || (is_array($call_id) && count($call_id) === 0)) {
+ throw new InvalidArgumentException(
+ 'Missing the required parameter $call_id when calling getRecordingTranscription'
+ );
+ }
+ // verify the required parameter 'recording_id' is set
+ if ($recording_id === null || (is_array($recording_id) && count($recording_id) === 0)) {
+ throw new InvalidArgumentException(
+ 'Missing the required parameter $recording_id when calling getRecordingTranscription'
+ );
+ }
+
+ $resourcePath = '/accounts/{accountId}/calls/{callId}/recordings/{recordingId}/transcription';
+ $queryParams = [];
+ $headerParams = [];
+ $httpBody = '';
+ $multipart = false;
+
+
+
+ // path params
+ if ($account_id !== null) {
+ $resourcePath = str_replace(
+ '{accountId}',
+ ObjectSerializer::toPathValue($account_id),
+ $resourcePath
+ );
+ }
+ // path params
+ if ($call_id !== null) {
+ $resourcePath = str_replace(
+ '{callId}',
+ ObjectSerializer::toPathValue($call_id),
+ $resourcePath
+ );
+ }
+ // path params
+ if ($recording_id !== null) {
+ $resourcePath = str_replace(
+ '{recordingId}',
+ ObjectSerializer::toPathValue($recording_id),
+ $resourcePath
+ );
+ }
+
+
+ $headers = $this->headerSelector->selectHeaders(
+ ['application/json', ],
+ $contentType,
+ $multipart
+ );
+
+
+ // this endpoint requires HTTP basic authentication
+ if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) {
+ $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword());
+ }
+
+ // this endpoint requires OAuth (access token)
+ if (!empty($this->config->getAccessToken())) {
+ $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken();
+ }
+
+ $defaultHeaders = [];
+ if ($this->config->getUserAgent()) {
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
+ }
+
+ $headers = array_merge(
+ $defaultHeaders,
+ $headerParams,
+ $headers
+ );
+
+ if ($this->config->getIgnoreOperationHosts()) {
+ $operationHost = $this->config->getHost();
+ } else {
+ # Preserve the original behavior of server indexing.
+ if ($hostIndex === null) {
+ $hostIndex = $this->hostIndex;
+ }
+
+ $hostSettings = $this->getHostSettingsForgetRecordingTranscription();
+
+ if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) {
+ throw new InvalidArgumentException("Invalid index {$hostIndex} when selecting the host. Must be less than ".count($hostSettings));
+ }
+ $operationHost = Configuration::getHostString($hostSettings, $hostIndex, $variables);
+ }
+ $query = ObjectSerializer::buildQuery($queryParams);
+ return new Request(
+ 'GET',
+ $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
+ $headers,
+ $httpBody
+ );
+ }
+
+ /**
+ * Returns an array of host settings for Operation getRecordingTranscription
+ *
+ * @return array an array of host settings
+ */
+ protected function getHostSettingsForgetRecordingTranscription(): array
+ {
+ return [
+ [
+ "url" => "https://voice.bandwidth.com/api/v2",
+ "description" => "Production",
+ ]
+ ];
+ }
+
+ /**
+ * Operation listAccountCallRecordings
+ *
+ * Get Call Recordings
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://voice.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string|null $to Filter results by the `to` field. (optional)
+ * @param string|null $from Filter results by the `from` field. (optional)
+ * @param string|null $min_start_time Filter results to recordings which have a `startTime` after or including `minStartTime` (in ISO8601 format). (optional)
+ * @param string|null $max_start_time Filter results to recordings which have a `startTime` before `maxStartTime` (in ISO8601 format). (optional)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listAccountCallRecordings'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return \Bandwidth\Model\CallRecordingMetadata[]|\Bandwidth\Model\VoiceApiError
+ */
+ public function listAccountCallRecordings(
+ string $account_id,
+ ?string $to = null,
+ ?string $from = null,
+ ?string $min_start_time = null,
+ ?string $max_start_time = null,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['listAccountCallRecordings'][0]
+ ): array|\Bandwidth\Model\VoiceApiError
+ {
+ list($response) = $this->listAccountCallRecordingsWithHttpInfo($account_id, $to, $from, $min_start_time, $max_start_time, $hostIndex, $variables, $contentType);
+ return $response;
+ }
+
+ /**
+ * Operation listAccountCallRecordingsWithHttpInfo
+ *
+ * Get Call Recordings
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://voice.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string|null $to Filter results by the `to` field. (optional)
+ * @param string|null $from Filter results by the `from` field. (optional)
+ * @param string|null $min_start_time Filter results to recordings which have a `startTime` after or including `minStartTime` (in ISO8601 format). (optional)
+ * @param string|null $max_start_time Filter results to recordings which have a `startTime` before `maxStartTime` (in ISO8601 format). (optional)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listAccountCallRecordings'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return array{0: \Bandwidth\Model\CallRecordingMetadata[]|\Bandwidth\Model\VoiceApiError, 1: int, 2: array} [response data, HTTP status code, HTTP response headers]
+ */
+ public function listAccountCallRecordingsWithHttpInfo(
+ string $account_id,
+ ?string $to = null,
+ ?string $from = null,
+ ?string $min_start_time = null,
+ ?string $max_start_time = null,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['listAccountCallRecordings'][0]
+ ): array
+ {
+ $request = $this->listAccountCallRecordingsRequest($account_id, $to, $from, $min_start_time, $max_start_time, $hostIndex, $variables, $contentType);
+
+ try {
+ $options = $this->createHttpClientOption();
+ try {
+ $response = $this->client->send($request, $options);
+ } catch (RequestException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
+ $e->getResponse() ? (string) $e->getResponse()->getBody() : null
+ );
+ } catch (ConnectException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ null,
+ null
+ );
+ }
+
+ $statusCode = $response->getStatusCode();
+
+ switch($statusCode) {
+ case 200:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\CallRecordingMetadata[]',
+ $request,
+ $response,
+ );
+ case 400:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\VoiceApiError',
+ $request,
+ $response,
+ );
+ case 401:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\VoiceApiError',
+ $request,
+ $response,
+ );
+ case 403:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\VoiceApiError',
+ $request,
+ $response,
+ );
+ case 404:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\VoiceApiError',
+ $request,
+ $response,
+ );
+ case 405:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\VoiceApiError',
+ $request,
+ $response,
+ );
+ case 415:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\VoiceApiError',
+ $request,
+ $response,
+ );
+ case 429:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\VoiceApiError',
+ $request,
+ $response,
+ );
+ case 500:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\VoiceApiError',
+ $request,
+ $response,
+ );
+ }
+
+ if ($statusCode < 200 || $statusCode > 299) {
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ (string) $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\CallRecordingMetadata[]',
+ $request,
+ $response,
+ );
+ } catch (ApiException $e) {
+ switch ($e->getCode()) {
+ case 200:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\CallRecordingMetadata[]',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 400:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 401:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 403:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 404:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 405:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 415:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 429:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 500:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ }
+
+ throw $e;
+ }
+ }
+
+ /**
+ * Operation listAccountCallRecordingsAsync
+ *
+ * Get Call Recordings
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://voice.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string|null $to Filter results by the `to` field. (optional)
+ * @param string|null $from Filter results by the `from` field. (optional)
+ * @param string|null $min_start_time Filter results to recordings which have a `startTime` after or including `minStartTime` (in ISO8601 format). (optional)
+ * @param string|null $max_start_time Filter results to recordings which have a `startTime` before `maxStartTime` (in ISO8601 format). (optional)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listAccountCallRecordings'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function listAccountCallRecordingsAsync(
+ string $account_id,
+ ?string $to = null,
+ ?string $from = null,
+ ?string $min_start_time = null,
+ ?string $max_start_time = null,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['listAccountCallRecordings'][0]
+ ): PromiseInterface
+ {
+ return $this->listAccountCallRecordingsAsyncWithHttpInfo($account_id, $to, $from, $min_start_time, $max_start_time, $hostIndex, $variables, $contentType)
+ ->then(
+ function ($response) {
+ return $response[0];
+ }
+ );
+ }
+
+ /**
+ * Operation listAccountCallRecordingsAsyncWithHttpInfo
+ *
+ * Get Call Recordings
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://voice.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string|null $to Filter results by the `to` field. (optional)
+ * @param string|null $from Filter results by the `from` field. (optional)
+ * @param string|null $min_start_time Filter results to recordings which have a `startTime` after or including `minStartTime` (in ISO8601 format). (optional)
+ * @param string|null $max_start_time Filter results to recordings which have a `startTime` before `maxStartTime` (in ISO8601 format). (optional)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listAccountCallRecordings'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function listAccountCallRecordingsAsyncWithHttpInfo(
+ string $account_id,
+ ?string $to = null,
+ ?string $from = null,
+ ?string $min_start_time = null,
+ ?string $max_start_time = null,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['listAccountCallRecordings'][0]
+ ): PromiseInterface
+ {
+ $returnType = '\Bandwidth\Model\CallRecordingMetadata[]';
+ $request = $this->listAccountCallRecordingsRequest($account_id, $to, $from, $min_start_time, $max_start_time, $hostIndex, $variables, $contentType);
+
+ return $this->client
+ ->sendAsync($request, $this->createHttpClientOption())
+ ->then(
+ function ($response) use ($returnType) {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ },
+ function ($exception) {
+ $response = $exception->getResponse();
+ $statusCode = $response->getStatusCode();
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ $exception->getRequest()->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+ );
+ }
+
+ /**
+ * Create request for operation 'listAccountCallRecordings'
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://voice.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string|null $to Filter results by the `to` field. (optional)
+ * @param string|null $from Filter results by the `from` field. (optional)
+ * @param string|null $min_start_time Filter results to recordings which have a `startTime` after or including `minStartTime` (in ISO8601 format). (optional)
+ * @param string|null $max_start_time Filter results to recordings which have a `startTime` before `maxStartTime` (in ISO8601 format). (optional)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listAccountCallRecordings'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return \GuzzleHttp\Psr7\Request
+ */
+ public function listAccountCallRecordingsRequest(
+ string $account_id,
+ ?string $to = null,
+ ?string $from = null,
+ ?string $min_start_time = null,
+ ?string $max_start_time = null,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['listAccountCallRecordings'][0]
+ ): Request
+ {
+ // verify the required parameter 'account_id' is set
+ if ($account_id === null || (is_array($account_id) && count($account_id) === 0)) {
+ throw new InvalidArgumentException(
+ 'Missing the required parameter $account_id when calling listAccountCallRecordings'
+ );
+ }
+
+ $resourcePath = '/accounts/{accountId}/recordings';
+ $queryParams = [];
+ $headerParams = [];
+ $httpBody = '';
+ $multipart = false;
+
+ // query params
+ $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+ $to,
+ 'to', // param base name
+ 'string', // openApiType
+ 'form', // style
+ true, // explode
+ false // required
+ ) ?? []);
+ // query params
+ $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+ $from,
+ 'from', // param base name
+ 'string', // openApiType
+ 'form', // style
+ true, // explode
+ false // required
+ ) ?? []);
+ // query params
+ $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+ $min_start_time,
+ 'minStartTime', // param base name
+ 'string', // openApiType
+ 'form', // style
+ true, // explode
+ false // required
+ ) ?? []);
+ // query params
+ $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+ $max_start_time,
+ 'maxStartTime', // param base name
+ 'string', // openApiType
+ 'form', // style
+ true, // explode
+ false // required
+ ) ?? []);
+
+
+ // path params
+ if ($account_id !== null) {
+ $resourcePath = str_replace(
+ '{accountId}',
+ ObjectSerializer::toPathValue($account_id),
+ $resourcePath
+ );
+ }
+
+
+ $headers = $this->headerSelector->selectHeaders(
+ ['application/json', ],
+ $contentType,
+ $multipart
+ );
+
+
+ // this endpoint requires HTTP basic authentication
+ if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) {
+ $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword());
+ }
+
+ // this endpoint requires OAuth (access token)
+ if (!empty($this->config->getAccessToken())) {
+ $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken();
+ }
+
+ $defaultHeaders = [];
+ if ($this->config->getUserAgent()) {
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
+ }
+
+ $headers = array_merge(
+ $defaultHeaders,
+ $headerParams,
+ $headers
+ );
+
+ if ($this->config->getIgnoreOperationHosts()) {
+ $operationHost = $this->config->getHost();
+ } else {
+ # Preserve the original behavior of server indexing.
+ if ($hostIndex === null) {
+ $hostIndex = $this->hostIndex;
+ }
+
+ $hostSettings = $this->getHostSettingsForlistAccountCallRecordings();
+
+ if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) {
+ throw new InvalidArgumentException("Invalid index {$hostIndex} when selecting the host. Must be less than ".count($hostSettings));
+ }
+ $operationHost = Configuration::getHostString($hostSettings, $hostIndex, $variables);
+ }
+ $query = ObjectSerializer::buildQuery($queryParams);
+ return new Request(
+ 'GET',
+ $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
+ $headers,
+ $httpBody
+ );
+ }
+
+ /**
+ * Returns an array of host settings for Operation listAccountCallRecordings
+ *
+ * @return array an array of host settings
+ */
+ protected function getHostSettingsForlistAccountCallRecordings(): array
+ {
+ return [
+ [
+ "url" => "https://voice.bandwidth.com/api/v2",
+ "description" => "Production",
+ ]
+ ];
+ }
+
+ /**
+ * Operation listCallRecordings
+ *
+ * List Call Recordings
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://voice.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $call_id Programmable Voice API Call ID. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listCallRecordings'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return \Bandwidth\Model\CallRecordingMetadata[]|\Bandwidth\Model\VoiceApiError
+ */
+ public function listCallRecordings(
+ string $account_id,
+ string $call_id,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['listCallRecordings'][0]
+ ): array|\Bandwidth\Model\VoiceApiError
+ {
+ list($response) = $this->listCallRecordingsWithHttpInfo($account_id, $call_id, $hostIndex, $variables, $contentType);
+ return $response;
+ }
+
+ /**
+ * Operation listCallRecordingsWithHttpInfo
+ *
+ * List Call Recordings
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://voice.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $call_id Programmable Voice API Call ID. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listCallRecordings'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return array{0: \Bandwidth\Model\CallRecordingMetadata[]|\Bandwidth\Model\VoiceApiError, 1: int, 2: array} [response data, HTTP status code, HTTP response headers]
+ */
+ public function listCallRecordingsWithHttpInfo(
+ string $account_id,
+ string $call_id,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['listCallRecordings'][0]
+ ): array
+ {
+ $request = $this->listCallRecordingsRequest($account_id, $call_id, $hostIndex, $variables, $contentType);
+
+ try {
+ $options = $this->createHttpClientOption();
+ try {
+ $response = $this->client->send($request, $options);
+ } catch (RequestException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
+ $e->getResponse() ? (string) $e->getResponse()->getBody() : null
+ );
+ } catch (ConnectException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ null,
+ null
+ );
+ }
+
+ $statusCode = $response->getStatusCode();
+
+ switch($statusCode) {
+ case 200:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\CallRecordingMetadata[]',
+ $request,
+ $response,
+ );
+ case 400:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\VoiceApiError',
+ $request,
+ $response,
+ );
+ case 401:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\VoiceApiError',
+ $request,
+ $response,
+ );
+ case 403:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\VoiceApiError',
+ $request,
+ $response,
+ );
+ case 404:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\VoiceApiError',
+ $request,
+ $response,
+ );
+ case 405:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\VoiceApiError',
+ $request,
+ $response,
+ );
+ case 415:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\VoiceApiError',
+ $request,
+ $response,
+ );
+ case 429:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\VoiceApiError',
+ $request,
+ $response,
+ );
+ case 500:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\VoiceApiError',
+ $request,
+ $response,
+ );
+ }
+
+ if ($statusCode < 200 || $statusCode > 299) {
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ (string) $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\CallRecordingMetadata[]',
+ $request,
+ $response,
+ );
+ } catch (ApiException $e) {
+ switch ($e->getCode()) {
+ case 200:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\CallRecordingMetadata[]',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 400:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 401:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 403:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 404:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 405:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 415:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 429:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 500:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ }
+
+ throw $e;
+ }
+ }
+
+ /**
+ * Operation listCallRecordingsAsync
+ *
+ * List Call Recordings
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://voice.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $call_id Programmable Voice API Call ID. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listCallRecordings'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function listCallRecordingsAsync(
+ string $account_id,
+ string $call_id,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['listCallRecordings'][0]
+ ): PromiseInterface
+ {
+ return $this->listCallRecordingsAsyncWithHttpInfo($account_id, $call_id, $hostIndex, $variables, $contentType)
+ ->then(
+ function ($response) {
+ return $response[0];
+ }
+ );
+ }
+
+ /**
+ * Operation listCallRecordingsAsyncWithHttpInfo
+ *
+ * List Call Recordings
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://voice.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $call_id Programmable Voice API Call ID. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listCallRecordings'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function listCallRecordingsAsyncWithHttpInfo(
+ string $account_id,
+ string $call_id,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['listCallRecordings'][0]
+ ): PromiseInterface
+ {
+ $returnType = '\Bandwidth\Model\CallRecordingMetadata[]';
+ $request = $this->listCallRecordingsRequest($account_id, $call_id, $hostIndex, $variables, $contentType);
+
+ return $this->client
+ ->sendAsync($request, $this->createHttpClientOption())
+ ->then(
+ function ($response) use ($returnType) {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ },
+ function ($exception) {
+ $response = $exception->getResponse();
+ $statusCode = $response->getStatusCode();
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ $exception->getRequest()->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+ );
+ }
+
+ /**
+ * Create request for operation 'listCallRecordings'
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://voice.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $call_id Programmable Voice API Call ID. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listCallRecordings'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return \GuzzleHttp\Psr7\Request
+ */
+ public function listCallRecordingsRequest(
+ string $account_id,
+ string $call_id,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['listCallRecordings'][0]
+ ): Request
+ {
+ // verify the required parameter 'account_id' is set
+ if ($account_id === null || (is_array($account_id) && count($account_id) === 0)) {
+ throw new InvalidArgumentException(
+ 'Missing the required parameter $account_id when calling listCallRecordings'
+ );
+ }
+ // verify the required parameter 'call_id' is set
+ if ($call_id === null || (is_array($call_id) && count($call_id) === 0)) {
+ throw new InvalidArgumentException(
+ 'Missing the required parameter $call_id when calling listCallRecordings'
+ );
+ }
+
+ $resourcePath = '/accounts/{accountId}/calls/{callId}/recordings';
+ $queryParams = [];
+ $headerParams = [];
+ $httpBody = '';
+ $multipart = false;
+
+
+
+ // path params
+ if ($account_id !== null) {
+ $resourcePath = str_replace(
+ '{accountId}',
+ ObjectSerializer::toPathValue($account_id),
+ $resourcePath
+ );
+ }
+ // path params
+ if ($call_id !== null) {
+ $resourcePath = str_replace(
+ '{callId}',
+ ObjectSerializer::toPathValue($call_id),
+ $resourcePath
+ );
+ }
+
+
+ $headers = $this->headerSelector->selectHeaders(
+ ['application/json', ],
+ $contentType,
+ $multipart
+ );
+
+
+ // this endpoint requires HTTP basic authentication
+ if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) {
+ $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword());
+ }
+
+ // this endpoint requires OAuth (access token)
+ if (!empty($this->config->getAccessToken())) {
+ $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken();
+ }
+
+ $defaultHeaders = [];
+ if ($this->config->getUserAgent()) {
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
+ }
+
+ $headers = array_merge(
+ $defaultHeaders,
+ $headerParams,
+ $headers
+ );
+
+ if ($this->config->getIgnoreOperationHosts()) {
+ $operationHost = $this->config->getHost();
+ } else {
+ # Preserve the original behavior of server indexing.
+ if ($hostIndex === null) {
+ $hostIndex = $this->hostIndex;
+ }
+
+ $hostSettings = $this->getHostSettingsForlistCallRecordings();
+
+ if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) {
+ throw new InvalidArgumentException("Invalid index {$hostIndex} when selecting the host. Must be less than ".count($hostSettings));
+ }
+ $operationHost = Configuration::getHostString($hostSettings, $hostIndex, $variables);
+ }
+ $query = ObjectSerializer::buildQuery($queryParams);
+ return new Request(
+ 'GET',
+ $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
+ $headers,
+ $httpBody
+ );
+ }
+
+ /**
+ * Returns an array of host settings for Operation listCallRecordings
+ *
+ * @return array an array of host settings
+ */
+ protected function getHostSettingsForlistCallRecordings(): array
+ {
+ return [
+ [
+ "url" => "https://voice.bandwidth.com/api/v2",
+ "description" => "Production",
+ ]
+ ];
+ }
+
+ /**
+ * Operation transcribeCallRecording
+ *
+ * Create Transcription Request
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://voice.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $call_id Programmable Voice API Call ID. (required)
+ * @param string $recording_id Programmable Voice API Recording ID. (required)
+ * @param \Bandwidth\Model\TranscribeRecording $transcribe_recording transcribe_recording (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['transcribeCallRecording'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return \Bandwidth\Model\VoiceApiError|null
+ */
+ public function transcribeCallRecording(
+ string $account_id,
+ string $call_id,
+ string $recording_id,
+ \Bandwidth\Model\TranscribeRecording $transcribe_recording,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['transcribeCallRecording'][0]
+ ): ?\Bandwidth\Model\VoiceApiError
+ {
+ list($response) = $this->transcribeCallRecordingWithHttpInfo($account_id, $call_id, $recording_id, $transcribe_recording, $hostIndex, $variables, $contentType);
+ return $response;
+ }
+
+ /**
+ * Operation transcribeCallRecordingWithHttpInfo
+ *
+ * Create Transcription Request
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://voice.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $call_id Programmable Voice API Call ID. (required)
+ * @param string $recording_id Programmable Voice API Recording ID. (required)
+ * @param \Bandwidth\Model\TranscribeRecording $transcribe_recording (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['transcribeCallRecording'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return array{0: null, 1: int, 2: array} [response data, HTTP status code, HTTP response headers]
+ */
+ public function transcribeCallRecordingWithHttpInfo(
+ string $account_id,
+ string $call_id,
+ string $recording_id,
+ \Bandwidth\Model\TranscribeRecording $transcribe_recording,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['transcribeCallRecording'][0]
+ ): array
+ {
+ $request = $this->transcribeCallRecordingRequest($account_id, $call_id, $recording_id, $transcribe_recording, $hostIndex, $variables, $contentType);
+
+ try {
+ $options = $this->createHttpClientOption();
+ try {
+ $response = $this->client->send($request, $options);
+ } catch (RequestException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
+ $e->getResponse() ? (string) $e->getResponse()->getBody() : null
+ );
+ } catch (ConnectException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ null,
+ null
+ );
+ }
+
+ $statusCode = $response->getStatusCode();
+
+
+ return [null, $statusCode, $response->getHeaders()];
+ } catch (ApiException $e) {
+ switch ($e->getCode()) {
+ case 400:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 401:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 403:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 404:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 405:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 415:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 429:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 500:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ }
+
+ throw $e;
+ }
+ }
+
+ /**
+ * Operation transcribeCallRecordingAsync
+ *
+ * Create Transcription Request
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://voice.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $call_id Programmable Voice API Call ID. (required)
+ * @param string $recording_id Programmable Voice API Recording ID. (required)
+ * @param \Bandwidth\Model\TranscribeRecording $transcribe_recording (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['transcribeCallRecording'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function transcribeCallRecordingAsync(
+ string $account_id,
+ string $call_id,
+ string $recording_id,
+ \Bandwidth\Model\TranscribeRecording $transcribe_recording,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['transcribeCallRecording'][0]
+ ): PromiseInterface
+ {
+ return $this->transcribeCallRecordingAsyncWithHttpInfo($account_id, $call_id, $recording_id, $transcribe_recording, $hostIndex, $variables, $contentType)
+ ->then(
+ function ($response) {
+ return $response[0];
+ }
+ );
+ }
+
+ /**
+ * Operation transcribeCallRecordingAsyncWithHttpInfo
+ *
+ * Create Transcription Request
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://voice.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $call_id Programmable Voice API Call ID. (required)
+ * @param string $recording_id Programmable Voice API Recording ID. (required)
+ * @param \Bandwidth\Model\TranscribeRecording $transcribe_recording (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['transcribeCallRecording'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function transcribeCallRecordingAsyncWithHttpInfo(
+ string $account_id,
+ string $call_id,
+ string $recording_id,
+ \Bandwidth\Model\TranscribeRecording $transcribe_recording,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['transcribeCallRecording'][0]
+ ): PromiseInterface
+ {
+ $returnType = '';
+ $request = $this->transcribeCallRecordingRequest($account_id, $call_id, $recording_id, $transcribe_recording, $hostIndex, $variables, $contentType);
+
+ return $this->client
+ ->sendAsync($request, $this->createHttpClientOption())
+ ->then(
+ function ($response) use ($returnType) {
+ return [null, $response->getStatusCode(), $response->getHeaders()];
+ },
+ function ($exception) {
+ $response = $exception->getResponse();
+ $statusCode = $response->getStatusCode();
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ $exception->getRequest()->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+ );
+ }
+
+ /**
+ * Create request for operation 'transcribeCallRecording'
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://voice.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $call_id Programmable Voice API Call ID. (required)
+ * @param string $recording_id Programmable Voice API Recording ID. (required)
+ * @param \Bandwidth\Model\TranscribeRecording $transcribe_recording (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['transcribeCallRecording'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return \GuzzleHttp\Psr7\Request
+ */
+ public function transcribeCallRecordingRequest(
+ string $account_id,
+ string $call_id,
+ string $recording_id,
+ \Bandwidth\Model\TranscribeRecording $transcribe_recording,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['transcribeCallRecording'][0]
+ ): Request
+ {
+ // verify the required parameter 'account_id' is set
+ if ($account_id === null || (is_array($account_id) && count($account_id) === 0)) {
+ throw new InvalidArgumentException(
+ 'Missing the required parameter $account_id when calling transcribeCallRecording'
+ );
+ }
+ // verify the required parameter 'call_id' is set
+ if ($call_id === null || (is_array($call_id) && count($call_id) === 0)) {
+ throw new InvalidArgumentException(
+ 'Missing the required parameter $call_id when calling transcribeCallRecording'
+ );
+ }
+ // verify the required parameter 'recording_id' is set
+ if ($recording_id === null || (is_array($recording_id) && count($recording_id) === 0)) {
+ throw new InvalidArgumentException(
+ 'Missing the required parameter $recording_id when calling transcribeCallRecording'
+ );
+ }
+ // verify the required parameter 'transcribe_recording' is set
+ if ($transcribe_recording === null || (is_array($transcribe_recording) && count($transcribe_recording) === 0)) {
+ throw new InvalidArgumentException(
+ 'Missing the required parameter $transcribe_recording when calling transcribeCallRecording'
+ );
+ }
+
+ $resourcePath = '/accounts/{accountId}/calls/{callId}/recordings/{recordingId}/transcription';
+ $formParams = [];
+ $queryParams = [];
+ $headerParams = [];
+ $httpBody = '';
+ $multipart = false;
+
+
+
+ // path params
+ if ($account_id !== null) {
+ $resourcePath = str_replace(
+ '{accountId}',
+ ObjectSerializer::toPathValue($account_id),
+ $resourcePath
+ );
+ }
+ // path params
+ if ($call_id !== null) {
+ $resourcePath = str_replace(
+ '{callId}',
+ ObjectSerializer::toPathValue($call_id),
+ $resourcePath
+ );
+ }
+ // path params
+ if ($recording_id !== null) {
+ $resourcePath = str_replace(
+ '{recordingId}',
+ ObjectSerializer::toPathValue($recording_id),
+ $resourcePath
+ );
+ }
+
+
+ $headers = $this->headerSelector->selectHeaders(
+ ['application/json', ],
+ $contentType,
+ $multipart
+ );
+
+ // for model (json/xml)
+ if (isset($transcribe_recording)) {
+ if (stripos($headers['Content-Type'], 'application/json') !== false) {
+ # if Content-Type contains "application/json", json_encode the body
+ $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($transcribe_recording));
+ } else {
+ $httpBody = $transcribe_recording;
+ }
+ } elseif (count($formParams) > 0) {
+ if ($multipart) {
+ $multipartContents = [];
+ foreach ($formParams as $formParamName => $formParamValue) {
+ $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
+ foreach ($formParamValueItems as $formParamValueItem) {
+ $multipartContents[] = [
+ 'name' => $formParamName,
+ 'contents' => $formParamValueItem
+ ];
+ }
+ }
+ // for HTTP post (form)
+ $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents);
+
+ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
+ # if Content-Type contains "application/json", json_encode the form parameters
+ $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams);
+ } else {
+ // for HTTP post (form)
+ $httpBody = ObjectSerializer::buildQuery($formParams);
+ }
+ }
+
+ // this endpoint requires HTTP basic authentication
+ if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) {
+ $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword());
+ }
+
+ // this endpoint requires OAuth (access token)
+ if (!empty($this->config->getAccessToken())) {
+ $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken();
+ }
+
+ $defaultHeaders = [];
+ if ($this->config->getUserAgent()) {
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
+ }
+
+ $headers = array_merge(
+ $defaultHeaders,
+ $headerParams,
+ $headers
+ );
+
+ if ($this->config->getIgnoreOperationHosts()) {
+ $operationHost = $this->config->getHost();
+ } else {
+ # Preserve the original behavior of server indexing.
+ if ($hostIndex === null) {
+ $hostIndex = $this->hostIndex;
+ }
+
+ $hostSettings = $this->getHostSettingsFortranscribeCallRecording();
+
+ if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) {
+ throw new InvalidArgumentException("Invalid index {$hostIndex} when selecting the host. Must be less than ".count($hostSettings));
+ }
+ $operationHost = Configuration::getHostString($hostSettings, $hostIndex, $variables);
+ }
+ $query = ObjectSerializer::buildQuery($queryParams);
+ return new Request(
+ 'POST',
+ $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
+ $headers,
+ $httpBody
+ );
+ }
+
+ /**
+ * Returns an array of host settings for Operation transcribeCallRecording
+ *
+ * @return array an array of host settings
+ */
+ protected function getHostSettingsFortranscribeCallRecording(): array
+ {
+ return [
+ [
+ "url" => "https://voice.bandwidth.com/api/v2",
+ "description" => "Production",
+ ]
+ ];
+ }
+
+ /**
+ * Operation updateCallRecordingState
+ *
+ * Update Recording
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://voice.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $call_id Programmable Voice API Call ID. (required)
+ * @param \Bandwidth\Model\UpdateCallRecording $update_call_recording update_call_recording (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateCallRecordingState'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return \Bandwidth\Model\VoiceApiError|null
+ */
+ public function updateCallRecordingState(
+ string $account_id,
+ string $call_id,
+ \Bandwidth\Model\UpdateCallRecording $update_call_recording,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['updateCallRecordingState'][0]
+ ): ?\Bandwidth\Model\VoiceApiError
+ {
+ list($response) = $this->updateCallRecordingStateWithHttpInfo($account_id, $call_id, $update_call_recording, $hostIndex, $variables, $contentType);
+ return $response;
+ }
+
+ /**
+ * Operation updateCallRecordingStateWithHttpInfo
+ *
+ * Update Recording
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://voice.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $call_id Programmable Voice API Call ID. (required)
+ * @param \Bandwidth\Model\UpdateCallRecording $update_call_recording (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateCallRecordingState'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return array{0: null, 1: int, 2: array} [response data, HTTP status code, HTTP response headers]
+ */
+ public function updateCallRecordingStateWithHttpInfo(
+ string $account_id,
+ string $call_id,
+ \Bandwidth\Model\UpdateCallRecording $update_call_recording,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['updateCallRecordingState'][0]
+ ): array
+ {
+ $request = $this->updateCallRecordingStateRequest($account_id, $call_id, $update_call_recording, $hostIndex, $variables, $contentType);
+
+ try {
+ $options = $this->createHttpClientOption();
+ try {
+ $response = $this->client->send($request, $options);
+ } catch (RequestException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
+ $e->getResponse() ? (string) $e->getResponse()->getBody() : null
+ );
+ } catch (ConnectException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ null,
+ null
+ );
+ }
+
+ $statusCode = $response->getStatusCode();
+
+
+ return [null, $statusCode, $response->getHeaders()];
+ } catch (ApiException $e) {
+ switch ($e->getCode()) {
+ case 400:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 401:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 403:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 404:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 405:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 415:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 429:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 500:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ }
+
+ throw $e;
+ }
+ }
+
+ /**
+ * Operation updateCallRecordingStateAsync
+ *
+ * Update Recording
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://voice.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $call_id Programmable Voice API Call ID. (required)
+ * @param \Bandwidth\Model\UpdateCallRecording $update_call_recording (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateCallRecordingState'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function updateCallRecordingStateAsync(
+ string $account_id,
+ string $call_id,
+ \Bandwidth\Model\UpdateCallRecording $update_call_recording,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['updateCallRecordingState'][0]
+ ): PromiseInterface
+ {
+ return $this->updateCallRecordingStateAsyncWithHttpInfo($account_id, $call_id, $update_call_recording, $hostIndex, $variables, $contentType)
+ ->then(
+ function ($response) {
+ return $response[0];
+ }
+ );
+ }
+
+ /**
+ * Operation updateCallRecordingStateAsyncWithHttpInfo
+ *
+ * Update Recording
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://voice.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $call_id Programmable Voice API Call ID. (required)
+ * @param \Bandwidth\Model\UpdateCallRecording $update_call_recording (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateCallRecordingState'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function updateCallRecordingStateAsyncWithHttpInfo(
+ string $account_id,
+ string $call_id,
+ \Bandwidth\Model\UpdateCallRecording $update_call_recording,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['updateCallRecordingState'][0]
+ ): PromiseInterface
+ {
+ $returnType = '';
+ $request = $this->updateCallRecordingStateRequest($account_id, $call_id, $update_call_recording, $hostIndex, $variables, $contentType);
+
+ return $this->client
+ ->sendAsync($request, $this->createHttpClientOption())
+ ->then(
+ function ($response) use ($returnType) {
+ return [null, $response->getStatusCode(), $response->getHeaders()];
+ },
+ function ($exception) {
+ $response = $exception->getResponse();
+ $statusCode = $response->getStatusCode();
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ $exception->getRequest()->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+ );
+ }
+
+ /**
+ * Create request for operation 'updateCallRecordingState'
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://voice.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $call_id Programmable Voice API Call ID. (required)
+ * @param \Bandwidth\Model\UpdateCallRecording $update_call_recording (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateCallRecordingState'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return \GuzzleHttp\Psr7\Request
+ */
+ public function updateCallRecordingStateRequest(
+ string $account_id,
+ string $call_id,
+ \Bandwidth\Model\UpdateCallRecording $update_call_recording,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['updateCallRecordingState'][0]
+ ): Request
+ {
+ // verify the required parameter 'account_id' is set
+ if ($account_id === null || (is_array($account_id) && count($account_id) === 0)) {
+ throw new InvalidArgumentException(
+ 'Missing the required parameter $account_id when calling updateCallRecordingState'
+ );
+ }
+ // verify the required parameter 'call_id' is set
+ if ($call_id === null || (is_array($call_id) && count($call_id) === 0)) {
+ throw new InvalidArgumentException(
+ 'Missing the required parameter $call_id when calling updateCallRecordingState'
+ );
+ }
+ // verify the required parameter 'update_call_recording' is set
+ if ($update_call_recording === null || (is_array($update_call_recording) && count($update_call_recording) === 0)) {
+ throw new InvalidArgumentException(
+ 'Missing the required parameter $update_call_recording when calling updateCallRecordingState'
+ );
+ }
+
+ $resourcePath = '/accounts/{accountId}/calls/{callId}/recording';
+ $formParams = [];
+ $queryParams = [];
+ $headerParams = [];
+ $httpBody = '';
+ $multipart = false;
+
+
+
+ // path params
+ if ($account_id !== null) {
+ $resourcePath = str_replace(
+ '{accountId}',
+ ObjectSerializer::toPathValue($account_id),
+ $resourcePath
+ );
+ }
+ // path params
+ if ($call_id !== null) {
+ $resourcePath = str_replace(
+ '{callId}',
+ ObjectSerializer::toPathValue($call_id),
+ $resourcePath
+ );
+ }
+
+
+ $headers = $this->headerSelector->selectHeaders(
+ ['application/json', ],
+ $contentType,
+ $multipart
+ );
+
+ // for model (json/xml)
+ if (isset($update_call_recording)) {
+ if (stripos($headers['Content-Type'], 'application/json') !== false) {
+ # if Content-Type contains "application/json", json_encode the body
+ $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($update_call_recording));
+ } else {
+ $httpBody = $update_call_recording;
+ }
+ } elseif (count($formParams) > 0) {
+ if ($multipart) {
+ $multipartContents = [];
+ foreach ($formParams as $formParamName => $formParamValue) {
+ $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
+ foreach ($formParamValueItems as $formParamValueItem) {
+ $multipartContents[] = [
+ 'name' => $formParamName,
+ 'contents' => $formParamValueItem
+ ];
+ }
+ }
+ // for HTTP post (form)
+ $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents);
+
+ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
+ # if Content-Type contains "application/json", json_encode the form parameters
+ $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams);
+ } else {
+ // for HTTP post (form)
+ $httpBody = ObjectSerializer::buildQuery($formParams);
+ }
+ }
+
+ // this endpoint requires HTTP basic authentication
+ if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) {
+ $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword());
+ }
+
+ // this endpoint requires OAuth (access token)
+ if (!empty($this->config->getAccessToken())) {
+ $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken();
+ }
+
+ $defaultHeaders = [];
+ if ($this->config->getUserAgent()) {
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
+ }
+
+ $headers = array_merge(
+ $defaultHeaders,
+ $headerParams,
+ $headers
+ );
+
+ if ($this->config->getIgnoreOperationHosts()) {
+ $operationHost = $this->config->getHost();
+ } else {
+ # Preserve the original behavior of server indexing.
+ if ($hostIndex === null) {
+ $hostIndex = $this->hostIndex;
+ }
+
+ $hostSettings = $this->getHostSettingsForupdateCallRecordingState();
+
+ if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) {
+ throw new InvalidArgumentException("Invalid index {$hostIndex} when selecting the host. Must be less than ".count($hostSettings));
+ }
+ $operationHost = Configuration::getHostString($hostSettings, $hostIndex, $variables);
+ }
+ $query = ObjectSerializer::buildQuery($queryParams);
+ return new Request(
+ 'PUT',
+ $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
+ $headers,
+ $httpBody
+ );
+ }
+
+ /**
+ * Returns an array of host settings for Operation updateCallRecordingState
+ *
+ * @return array an array of host settings
+ */
+ protected function getHostSettingsForupdateCallRecordingState(): array
+ {
+ return [
+ [
+ "url" => "https://voice.bandwidth.com/api/v2",
+ "description" => "Production",
+ ]
+ ];
+ }
+
+ /**
+ * Create http client option
+ *
+ * @throws \RuntimeException on file opening failure
+ * @return array of http client options
+ */
+ protected function createHttpClientOption(): array
+ {
+ $options = [];
+ if ($this->config->getDebug()) {
+ $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a');
+ if (!$options[RequestOptions::DEBUG]) {
+ throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile());
+ }
+ }
+
+ return $options;
+ }
+
+ private function handleResponseWithDataType(
+ string $dataType,
+ RequestInterface $request,
+ ResponseInterface $response,
+ ): array {
+ if (in_array($dataType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($dataType !== 'string') {
+ try {
+ $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR);
+ } catch (\JsonException $exception) {
+ throw new ApiException(
+ sprintf(
+ 'Error JSON decoding server response (%s)',
+ $request->getUri()
+ ),
+ $response->getStatusCode(),
+ $response->getHeaders(),
+ $content
+ );
+ }
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $dataType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ }
+
+ private function responseWithinRangeCode(
+ string $rangeCode,
+ int $statusCode,
+ ): bool {
+ $left = (int) ($rangeCode[0].'00');
+ $right = (int) ($rangeCode[0].'99');
+
+ return $statusCode >= $left && $statusCode <= $right;
+ }
+}
diff --git a/src/Api/StatisticsApi.php b/src/Api/StatisticsApi.php
new file mode 100644
index 0000000..08d9a22
--- /dev/null
+++ b/src/Api/StatisticsApi.php
@@ -0,0 +1,630 @@
+ $contentTypes **/
+ public const contentTypes = [
+ 'getStatistics' => [
+ 'application/json',
+ ],
+ ];
+
+ /**
+ * @param ClientInterface|null $client
+ * @param Configuration|null $config
+ * @param HeaderSelector|null $selector
+ * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec
+ */
+ public function __construct(
+ ?ClientInterface $client = null,
+ ?Configuration $config = null,
+ ?HeaderSelector $selector = null,
+ int $hostIndex = 0
+ ) {
+ $this->client = $client ?: new Client();
+ $this->config = $config ?: Configuration::getDefaultConfiguration();
+ $this->headerSelector = $selector ?: new HeaderSelector();
+ $this->hostIndex = $hostIndex;
+ }
+
+ /**
+ * Set the host index
+ *
+ * @param int $hostIndex Host index (required)
+ */
+ public function setHostIndex(int $hostIndex): void
+ {
+ $this->hostIndex = $hostIndex;
+ }
+
+ /**
+ * Get the host index
+ *
+ * @return int Host index
+ */
+ public function getHostIndex(): int
+ {
+ return $this->hostIndex;
+ }
+
+ /**
+ * @return Configuration
+ */
+ public function getConfig(): Configuration
+ {
+ return $this->config;
+ }
+
+ /**
+ * Operation getStatistics
+ *
+ * Get Account Statistics
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://voice.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getStatistics'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return \Bandwidth\Model\AccountStatistics|\Bandwidth\Model\VoiceApiError
+ */
+ public function getStatistics(
+ string $account_id,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['getStatistics'][0]
+ ): \Bandwidth\Model\AccountStatistics|\Bandwidth\Model\VoiceApiError
+ {
+ list($response) = $this->getStatisticsWithHttpInfo($account_id, $hostIndex, $variables, $contentType);
+ return $response;
+ }
+
+ /**
+ * Operation getStatisticsWithHttpInfo
+ *
+ * Get Account Statistics
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://voice.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getStatistics'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return array{0: \Bandwidth\Model\AccountStatistics|\Bandwidth\Model\VoiceApiError, 1: int, 2: array} [response data, HTTP status code, HTTP response headers]
+ */
+ public function getStatisticsWithHttpInfo(
+ string $account_id,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['getStatistics'][0]
+ ): array
+ {
+ $request = $this->getStatisticsRequest($account_id, $hostIndex, $variables, $contentType);
+
+ try {
+ $options = $this->createHttpClientOption();
+ try {
+ $response = $this->client->send($request, $options);
+ } catch (RequestException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
+ $e->getResponse() ? (string) $e->getResponse()->getBody() : null
+ );
+ } catch (ConnectException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ null,
+ null
+ );
+ }
+
+ $statusCode = $response->getStatusCode();
+
+ switch($statusCode) {
+ case 200:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\AccountStatistics',
+ $request,
+ $response,
+ );
+ case 400:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\VoiceApiError',
+ $request,
+ $response,
+ );
+ case 401:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\VoiceApiError',
+ $request,
+ $response,
+ );
+ case 403:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\VoiceApiError',
+ $request,
+ $response,
+ );
+ case 404:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\VoiceApiError',
+ $request,
+ $response,
+ );
+ case 405:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\VoiceApiError',
+ $request,
+ $response,
+ );
+ case 415:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\VoiceApiError',
+ $request,
+ $response,
+ );
+ case 429:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\VoiceApiError',
+ $request,
+ $response,
+ );
+ case 500:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\VoiceApiError',
+ $request,
+ $response,
+ );
+ }
+
+ if ($statusCode < 200 || $statusCode > 299) {
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ (string) $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\AccountStatistics',
+ $request,
+ $response,
+ );
+ } catch (ApiException $e) {
+ switch ($e->getCode()) {
+ case 200:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\AccountStatistics',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 400:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 401:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 403:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 404:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 405:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 415:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 429:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 500:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ }
+
+ throw $e;
+ }
+ }
+
+ /**
+ * Operation getStatisticsAsync
+ *
+ * Get Account Statistics
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://voice.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getStatistics'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function getStatisticsAsync(
+ string $account_id,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['getStatistics'][0]
+ ): PromiseInterface
+ {
+ return $this->getStatisticsAsyncWithHttpInfo($account_id, $hostIndex, $variables, $contentType)
+ ->then(
+ function ($response) {
+ return $response[0];
+ }
+ );
+ }
+
+ /**
+ * Operation getStatisticsAsyncWithHttpInfo
+ *
+ * Get Account Statistics
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://voice.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getStatistics'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function getStatisticsAsyncWithHttpInfo(
+ string $account_id,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['getStatistics'][0]
+ ): PromiseInterface
+ {
+ $returnType = '\Bandwidth\Model\AccountStatistics';
+ $request = $this->getStatisticsRequest($account_id, $hostIndex, $variables, $contentType);
+
+ return $this->client
+ ->sendAsync($request, $this->createHttpClientOption())
+ ->then(
+ function ($response) use ($returnType) {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ },
+ function ($exception) {
+ $response = $exception->getResponse();
+ $statusCode = $response->getStatusCode();
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ $exception->getRequest()->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+ );
+ }
+
+ /**
+ * Create request for operation 'getStatistics'
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://voice.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getStatistics'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return \GuzzleHttp\Psr7\Request
+ */
+ public function getStatisticsRequest(
+ string $account_id,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['getStatistics'][0]
+ ): Request
+ {
+ // verify the required parameter 'account_id' is set
+ if ($account_id === null || (is_array($account_id) && count($account_id) === 0)) {
+ throw new InvalidArgumentException(
+ 'Missing the required parameter $account_id when calling getStatistics'
+ );
+ }
+
+ $resourcePath = '/accounts/{accountId}/statistics';
+ $queryParams = [];
+ $headerParams = [];
+ $httpBody = '';
+ $multipart = false;
+
+
+
+ // path params
+ if ($account_id !== null) {
+ $resourcePath = str_replace(
+ '{accountId}',
+ ObjectSerializer::toPathValue($account_id),
+ $resourcePath
+ );
+ }
+
+
+ $headers = $this->headerSelector->selectHeaders(
+ ['application/json', ],
+ $contentType,
+ $multipart
+ );
+
+
+ // this endpoint requires HTTP basic authentication
+ if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) {
+ $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword());
+ }
+
+ // this endpoint requires OAuth (access token)
+ if (!empty($this->config->getAccessToken())) {
+ $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken();
+ }
+
+ $defaultHeaders = [];
+ if ($this->config->getUserAgent()) {
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
+ }
+
+ $headers = array_merge(
+ $defaultHeaders,
+ $headerParams,
+ $headers
+ );
+
+ if ($this->config->getIgnoreOperationHosts()) {
+ $operationHost = $this->config->getHost();
+ } else {
+ # Preserve the original behavior of server indexing.
+ if ($hostIndex === null) {
+ $hostIndex = $this->hostIndex;
+ }
+
+ $hostSettings = $this->getHostSettingsForgetStatistics();
+
+ if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) {
+ throw new InvalidArgumentException("Invalid index {$hostIndex} when selecting the host. Must be less than ".count($hostSettings));
+ }
+ $operationHost = Configuration::getHostString($hostSettings, $hostIndex, $variables);
+ }
+ $query = ObjectSerializer::buildQuery($queryParams);
+ return new Request(
+ 'GET',
+ $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
+ $headers,
+ $httpBody
+ );
+ }
+
+ /**
+ * Returns an array of host settings for Operation getStatistics
+ *
+ * @return array an array of host settings
+ */
+ protected function getHostSettingsForgetStatistics(): array
+ {
+ return [
+ [
+ "url" => "https://voice.bandwidth.com/api/v2",
+ "description" => "Production",
+ ]
+ ];
+ }
+
+ /**
+ * Create http client option
+ *
+ * @throws \RuntimeException on file opening failure
+ * @return array of http client options
+ */
+ protected function createHttpClientOption(): array
+ {
+ $options = [];
+ if ($this->config->getDebug()) {
+ $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a');
+ if (!$options[RequestOptions::DEBUG]) {
+ throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile());
+ }
+ }
+
+ return $options;
+ }
+
+ private function handleResponseWithDataType(
+ string $dataType,
+ RequestInterface $request,
+ ResponseInterface $response,
+ ): array {
+ if (in_array($dataType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($dataType !== 'string') {
+ try {
+ $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR);
+ } catch (\JsonException $exception) {
+ throw new ApiException(
+ sprintf(
+ 'Error JSON decoding server response (%s)',
+ $request->getUri()
+ ),
+ $response->getStatusCode(),
+ $response->getHeaders(),
+ $content
+ );
+ }
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $dataType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ }
+
+ private function responseWithinRangeCode(
+ string $rangeCode,
+ int $statusCode,
+ ): bool {
+ $left = (int) ($rangeCode[0].'00');
+ $right = (int) ($rangeCode[0].'99');
+
+ return $statusCode >= $left && $statusCode <= $right;
+ }
+}
diff --git a/src/Api/TollFreeVerificationApi.php b/src/Api/TollFreeVerificationApi.php
new file mode 100644
index 0000000..7acaa4e
--- /dev/null
+++ b/src/Api/TollFreeVerificationApi.php
@@ -0,0 +1,4099 @@
+ $contentTypes **/
+ public const contentTypes = [
+ 'createWebhookSubscription' => [
+ 'application/json',
+ ],
+ 'deleteVerificationRequest' => [
+ 'application/json',
+ ],
+ 'deleteWebhookSubscription' => [
+ 'application/json',
+ ],
+ 'getTollFreeVerificationStatus' => [
+ 'application/json',
+ ],
+ 'listTollFreeUseCases' => [
+ 'application/json',
+ ],
+ 'listWebhookSubscriptions' => [
+ 'application/json',
+ ],
+ 'requestTollFreeVerification' => [
+ 'application/json',
+ ],
+ 'updateTollFreeVerificationRequest' => [
+ 'application/json',
+ ],
+ 'updateWebhookSubscription' => [
+ 'application/json',
+ ],
+ ];
+
+ /**
+ * @param ClientInterface|null $client
+ * @param Configuration|null $config
+ * @param HeaderSelector|null $selector
+ * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec
+ */
+ public function __construct(
+ ?ClientInterface $client = null,
+ ?Configuration $config = null,
+ ?HeaderSelector $selector = null,
+ int $hostIndex = 0
+ ) {
+ $this->client = $client ?: new Client();
+ $this->config = $config ?: Configuration::getDefaultConfiguration();
+ $this->headerSelector = $selector ?: new HeaderSelector();
+ $this->hostIndex = $hostIndex;
+ }
+
+ /**
+ * Set the host index
+ *
+ * @param int $hostIndex Host index (required)
+ */
+ public function setHostIndex(int $hostIndex): void
+ {
+ $this->hostIndex = $hostIndex;
+ }
+
+ /**
+ * Get the host index
+ *
+ * @return int Host index
+ */
+ public function getHostIndex(): int
+ {
+ return $this->hostIndex;
+ }
+
+ /**
+ * @return Configuration
+ */
+ public function getConfig(): Configuration
+ {
+ return $this->config;
+ }
+
+ /**
+ * Operation createWebhookSubscription
+ *
+ * Create Webhook Subscription
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://api.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param \Bandwidth\Model\WebhookSubscriptionRequestSchema $webhook_subscription_request_schema Information about a webhook that Bandwidth should send upon the completion of event customer is trying to subscribe to. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createWebhookSubscription'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return \Bandwidth\Model\WebhookSubscription|\Bandwidth\Model\TfvError
+ */
+ public function createWebhookSubscription(
+ string $account_id,
+ \Bandwidth\Model\WebhookSubscriptionRequestSchema $webhook_subscription_request_schema,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['createWebhookSubscription'][0]
+ ): \Bandwidth\Model\WebhookSubscription|\Bandwidth\Model\TfvError
+ {
+ list($response) = $this->createWebhookSubscriptionWithHttpInfo($account_id, $webhook_subscription_request_schema, $hostIndex, $variables, $contentType);
+ return $response;
+ }
+
+ /**
+ * Operation createWebhookSubscriptionWithHttpInfo
+ *
+ * Create Webhook Subscription
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://api.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param \Bandwidth\Model\WebhookSubscriptionRequestSchema $webhook_subscription_request_schema Information about a webhook that Bandwidth should send upon the completion of event customer is trying to subscribe to. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createWebhookSubscription'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return array{0: \Bandwidth\Model\WebhookSubscription|\Bandwidth\Model\TfvError, 1: int, 2: array} [response data, HTTP status code, HTTP response headers]
+ */
+ public function createWebhookSubscriptionWithHttpInfo(
+ string $account_id,
+ \Bandwidth\Model\WebhookSubscriptionRequestSchema $webhook_subscription_request_schema,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['createWebhookSubscription'][0]
+ ): array
+ {
+ $request = $this->createWebhookSubscriptionRequest($account_id, $webhook_subscription_request_schema, $hostIndex, $variables, $contentType);
+
+ try {
+ $options = $this->createHttpClientOption();
+ try {
+ $response = $this->client->send($request, $options);
+ } catch (RequestException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
+ $e->getResponse() ? (string) $e->getResponse()->getBody() : null
+ );
+ } catch (ConnectException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ null,
+ null
+ );
+ }
+
+ $statusCode = $response->getStatusCode();
+
+ switch($statusCode) {
+ case 201:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\WebhookSubscription',
+ $request,
+ $response,
+ );
+ case 400:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\TfvError',
+ $request,
+ $response,
+ );
+ case 401:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\TfvError',
+ $request,
+ $response,
+ );
+ case 403:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\TfvError',
+ $request,
+ $response,
+ );
+ case 404:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\TfvError',
+ $request,
+ $response,
+ );
+ case 405:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\TfvError',
+ $request,
+ $response,
+ );
+ case 429:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\TfvError',
+ $request,
+ $response,
+ );
+ case 500:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\TfvError',
+ $request,
+ $response,
+ );
+ case 503:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\TfvError',
+ $request,
+ $response,
+ );
+ }
+
+ if ($statusCode < 200 || $statusCode > 299) {
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ (string) $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\WebhookSubscription',
+ $request,
+ $response,
+ );
+ } catch (ApiException $e) {
+ switch ($e->getCode()) {
+ case 201:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\WebhookSubscription',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 400:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\TfvError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 401:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\TfvError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 403:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\TfvError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 404:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\TfvError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 405:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\TfvError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 429:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\TfvError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 500:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\TfvError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 503:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\TfvError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ }
+
+ throw $e;
+ }
+ }
+
+ /**
+ * Operation createWebhookSubscriptionAsync
+ *
+ * Create Webhook Subscription
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://api.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param \Bandwidth\Model\WebhookSubscriptionRequestSchema $webhook_subscription_request_schema Information about a webhook that Bandwidth should send upon the completion of event customer is trying to subscribe to. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createWebhookSubscription'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function createWebhookSubscriptionAsync(
+ string $account_id,
+ \Bandwidth\Model\WebhookSubscriptionRequestSchema $webhook_subscription_request_schema,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['createWebhookSubscription'][0]
+ ): PromiseInterface
+ {
+ return $this->createWebhookSubscriptionAsyncWithHttpInfo($account_id, $webhook_subscription_request_schema, $hostIndex, $variables, $contentType)
+ ->then(
+ function ($response) {
+ return $response[0];
+ }
+ );
+ }
+
+ /**
+ * Operation createWebhookSubscriptionAsyncWithHttpInfo
+ *
+ * Create Webhook Subscription
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://api.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param \Bandwidth\Model\WebhookSubscriptionRequestSchema $webhook_subscription_request_schema Information about a webhook that Bandwidth should send upon the completion of event customer is trying to subscribe to. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createWebhookSubscription'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function createWebhookSubscriptionAsyncWithHttpInfo(
+ string $account_id,
+ \Bandwidth\Model\WebhookSubscriptionRequestSchema $webhook_subscription_request_schema,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['createWebhookSubscription'][0]
+ ): PromiseInterface
+ {
+ $returnType = '\Bandwidth\Model\WebhookSubscription';
+ $request = $this->createWebhookSubscriptionRequest($account_id, $webhook_subscription_request_schema, $hostIndex, $variables, $contentType);
+
+ return $this->client
+ ->sendAsync($request, $this->createHttpClientOption())
+ ->then(
+ function ($response) use ($returnType) {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ },
+ function ($exception) {
+ $response = $exception->getResponse();
+ $statusCode = $response->getStatusCode();
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ $exception->getRequest()->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+ );
+ }
+
+ /**
+ * Create request for operation 'createWebhookSubscription'
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://api.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param \Bandwidth\Model\WebhookSubscriptionRequestSchema $webhook_subscription_request_schema Information about a webhook that Bandwidth should send upon the completion of event customer is trying to subscribe to. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createWebhookSubscription'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return \GuzzleHttp\Psr7\Request
+ */
+ public function createWebhookSubscriptionRequest(
+ string $account_id,
+ \Bandwidth\Model\WebhookSubscriptionRequestSchema $webhook_subscription_request_schema,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['createWebhookSubscription'][0]
+ ): Request
+ {
+ // verify the required parameter 'account_id' is set
+ if ($account_id === null || (is_array($account_id) && count($account_id) === 0)) {
+ throw new InvalidArgumentException(
+ 'Missing the required parameter $account_id when calling createWebhookSubscription'
+ );
+ }
+ // verify the required parameter 'webhook_subscription_request_schema' is set
+ if ($webhook_subscription_request_schema === null || (is_array($webhook_subscription_request_schema) && count($webhook_subscription_request_schema) === 0)) {
+ throw new InvalidArgumentException(
+ 'Missing the required parameter $webhook_subscription_request_schema when calling createWebhookSubscription'
+ );
+ }
+
+ $resourcePath = '/accounts/{accountId}/tollFreeVerification/webhooks/subscriptions';
+ $formParams = [];
+ $queryParams = [];
+ $headerParams = [];
+ $httpBody = '';
+ $multipart = false;
+
+
+
+ // path params
+ if ($account_id !== null) {
+ $resourcePath = str_replace(
+ '{accountId}',
+ ObjectSerializer::toPathValue($account_id),
+ $resourcePath
+ );
+ }
+
+
+ $headers = $this->headerSelector->selectHeaders(
+ ['application/json', ],
+ $contentType,
+ $multipart
+ );
+
+ // for model (json/xml)
+ if (isset($webhook_subscription_request_schema)) {
+ if (stripos($headers['Content-Type'], 'application/json') !== false) {
+ # if Content-Type contains "application/json", json_encode the body
+ $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($webhook_subscription_request_schema));
+ } else {
+ $httpBody = $webhook_subscription_request_schema;
+ }
+ } elseif (count($formParams) > 0) {
+ if ($multipart) {
+ $multipartContents = [];
+ foreach ($formParams as $formParamName => $formParamValue) {
+ $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
+ foreach ($formParamValueItems as $formParamValueItem) {
+ $multipartContents[] = [
+ 'name' => $formParamName,
+ 'contents' => $formParamValueItem
+ ];
+ }
+ }
+ // for HTTP post (form)
+ $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents);
+
+ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
+ # if Content-Type contains "application/json", json_encode the form parameters
+ $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams);
+ } else {
+ // for HTTP post (form)
+ $httpBody = ObjectSerializer::buildQuery($formParams);
+ }
+ }
+
+ // this endpoint requires HTTP basic authentication
+ if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) {
+ $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword());
+ }
+
+ // this endpoint requires OAuth (access token)
+ if (!empty($this->config->getAccessToken())) {
+ $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken();
+ }
+
+ $defaultHeaders = [];
+ if ($this->config->getUserAgent()) {
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
+ }
+
+ $headers = array_merge(
+ $defaultHeaders,
+ $headerParams,
+ $headers
+ );
+
+ if ($this->config->getIgnoreOperationHosts()) {
+ $operationHost = $this->config->getHost();
+ } else {
+ # Preserve the original behavior of server indexing.
+ if ($hostIndex === null) {
+ $hostIndex = $this->hostIndex;
+ }
+
+ $hostSettings = $this->getHostSettingsForcreateWebhookSubscription();
+
+ if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) {
+ throw new InvalidArgumentException("Invalid index {$hostIndex} when selecting the host. Must be less than ".count($hostSettings));
+ }
+ $operationHost = Configuration::getHostString($hostSettings, $hostIndex, $variables);
+ }
+ $query = ObjectSerializer::buildQuery($queryParams);
+ return new Request(
+ 'POST',
+ $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
+ $headers,
+ $httpBody
+ );
+ }
+
+ /**
+ * Returns an array of host settings for Operation createWebhookSubscription
+ *
+ * @return array an array of host settings
+ */
+ protected function getHostSettingsForcreateWebhookSubscription(): array
+ {
+ return [
+ [
+ "url" => "https://api.bandwidth.com/api/v2",
+ "description" => "Production",
+ ]
+ ];
+ }
+
+ /**
+ * Operation deleteVerificationRequest
+ *
+ * Delete a Toll-Free Verification Submission
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://api.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $phone_number Valid Toll-Free telephone number in E.164 format. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteVerificationRequest'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return \Bandwidth\Model\TfvError|null
+ */
+ public function deleteVerificationRequest(
+ string $account_id,
+ string $phone_number,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['deleteVerificationRequest'][0]
+ ): ?\Bandwidth\Model\TfvError
+ {
+ list($response) = $this->deleteVerificationRequestWithHttpInfo($account_id, $phone_number, $hostIndex, $variables, $contentType);
+ return $response;
+ }
+
+ /**
+ * Operation deleteVerificationRequestWithHttpInfo
+ *
+ * Delete a Toll-Free Verification Submission
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://api.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $phone_number Valid Toll-Free telephone number in E.164 format. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteVerificationRequest'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return array{0: null, 1: int, 2: array} [response data, HTTP status code, HTTP response headers]
+ */
+ public function deleteVerificationRequestWithHttpInfo(
+ string $account_id,
+ string $phone_number,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['deleteVerificationRequest'][0]
+ ): array
+ {
+ $request = $this->deleteVerificationRequestRequest($account_id, $phone_number, $hostIndex, $variables, $contentType);
+
+ try {
+ $options = $this->createHttpClientOption();
+ try {
+ $response = $this->client->send($request, $options);
+ } catch (RequestException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
+ $e->getResponse() ? (string) $e->getResponse()->getBody() : null
+ );
+ } catch (ConnectException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ null,
+ null
+ );
+ }
+
+ $statusCode = $response->getStatusCode();
+
+
+ return [null, $statusCode, $response->getHeaders()];
+ } catch (ApiException $e) {
+ switch ($e->getCode()) {
+ case 400:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\TfvError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 401:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\TfvError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 403:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\TfvError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 404:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\TfvError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 405:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\TfvError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 429:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\TfvError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 500:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\TfvError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 503:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\TfvError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ }
+
+ throw $e;
+ }
+ }
+
+ /**
+ * Operation deleteVerificationRequestAsync
+ *
+ * Delete a Toll-Free Verification Submission
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://api.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $phone_number Valid Toll-Free telephone number in E.164 format. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteVerificationRequest'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function deleteVerificationRequestAsync(
+ string $account_id,
+ string $phone_number,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['deleteVerificationRequest'][0]
+ ): PromiseInterface
+ {
+ return $this->deleteVerificationRequestAsyncWithHttpInfo($account_id, $phone_number, $hostIndex, $variables, $contentType)
+ ->then(
+ function ($response) {
+ return $response[0];
+ }
+ );
+ }
+
+ /**
+ * Operation deleteVerificationRequestAsyncWithHttpInfo
+ *
+ * Delete a Toll-Free Verification Submission
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://api.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $phone_number Valid Toll-Free telephone number in E.164 format. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteVerificationRequest'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function deleteVerificationRequestAsyncWithHttpInfo(
+ string $account_id,
+ string $phone_number,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['deleteVerificationRequest'][0]
+ ): PromiseInterface
+ {
+ $returnType = '';
+ $request = $this->deleteVerificationRequestRequest($account_id, $phone_number, $hostIndex, $variables, $contentType);
+
+ return $this->client
+ ->sendAsync($request, $this->createHttpClientOption())
+ ->then(
+ function ($response) use ($returnType) {
+ return [null, $response->getStatusCode(), $response->getHeaders()];
+ },
+ function ($exception) {
+ $response = $exception->getResponse();
+ $statusCode = $response->getStatusCode();
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ $exception->getRequest()->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+ );
+ }
+
+ /**
+ * Create request for operation 'deleteVerificationRequest'
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://api.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $phone_number Valid Toll-Free telephone number in E.164 format. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteVerificationRequest'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return \GuzzleHttp\Psr7\Request
+ */
+ public function deleteVerificationRequestRequest(
+ string $account_id,
+ string $phone_number,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['deleteVerificationRequest'][0]
+ ): Request
+ {
+ // verify the required parameter 'account_id' is set
+ if ($account_id === null || (is_array($account_id) && count($account_id) === 0)) {
+ throw new InvalidArgumentException(
+ 'Missing the required parameter $account_id when calling deleteVerificationRequest'
+ );
+ }
+ // verify the required parameter 'phone_number' is set
+ if ($phone_number === null || (is_array($phone_number) && count($phone_number) === 0)) {
+ throw new InvalidArgumentException(
+ 'Missing the required parameter $phone_number when calling deleteVerificationRequest'
+ );
+ }
+ if (strlen($phone_number) > 12) {
+ throw new InvalidArgumentException('invalid length for "$phone_number" when calling TollFreeVerificationApi.deleteVerificationRequest, must be smaller than or equal to 12.');
+ }
+ if (strlen($phone_number) < 12) {
+ throw new InvalidArgumentException('invalid length for "$phone_number" when calling TollFreeVerificationApi.deleteVerificationRequest, must be bigger than or equal to 12.');
+ }
+ if (!preg_match("/^\\+1(800|833|844|855|866|877|888)[2-9]\\d{6}$/", $phone_number)) {
+ throw new InvalidArgumentException("invalid value for \"phone_number\" when calling TollFreeVerificationApi.deleteVerificationRequest, must conform to the pattern /^\\+1(800|833|844|855|866|877|888)[2-9]\\d{6}$/.");
+ }
+
+ $resourcePath = '/accounts/{accountId}/phoneNumbers/{phoneNumber}/tollFreeVerification';
+ $queryParams = [];
+ $headerParams = [];
+ $httpBody = '';
+ $multipart = false;
+
+
+
+ // path params
+ if ($account_id !== null) {
+ $resourcePath = str_replace(
+ '{accountId}',
+ ObjectSerializer::toPathValue($account_id),
+ $resourcePath
+ );
+ }
+ // path params
+ if ($phone_number !== null) {
+ $resourcePath = str_replace(
+ '{phoneNumber}',
+ ObjectSerializer::toPathValue($phone_number),
+ $resourcePath
+ );
+ }
+
+
+ $headers = $this->headerSelector->selectHeaders(
+ ['application/json', ],
+ $contentType,
+ $multipart
+ );
+
+
+ // this endpoint requires HTTP basic authentication
+ if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) {
+ $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword());
+ }
+
+ // this endpoint requires OAuth (access token)
+ if (!empty($this->config->getAccessToken())) {
+ $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken();
+ }
+
+ $defaultHeaders = [];
+ if ($this->config->getUserAgent()) {
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
+ }
+
+ $headers = array_merge(
+ $defaultHeaders,
+ $headerParams,
+ $headers
+ );
+
+ if ($this->config->getIgnoreOperationHosts()) {
+ $operationHost = $this->config->getHost();
+ } else {
+ # Preserve the original behavior of server indexing.
+ if ($hostIndex === null) {
+ $hostIndex = $this->hostIndex;
+ }
+
+ $hostSettings = $this->getHostSettingsFordeleteVerificationRequest();
+
+ if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) {
+ throw new InvalidArgumentException("Invalid index {$hostIndex} when selecting the host. Must be less than ".count($hostSettings));
+ }
+ $operationHost = Configuration::getHostString($hostSettings, $hostIndex, $variables);
+ }
+ $query = ObjectSerializer::buildQuery($queryParams);
+ return new Request(
+ 'DELETE',
+ $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
+ $headers,
+ $httpBody
+ );
+ }
+
+ /**
+ * Returns an array of host settings for Operation deleteVerificationRequest
+ *
+ * @return array an array of host settings
+ */
+ protected function getHostSettingsFordeleteVerificationRequest(): array
+ {
+ return [
+ [
+ "url" => "https://api.bandwidth.com/api/v2",
+ "description" => "Production",
+ ]
+ ];
+ }
+
+ /**
+ * Operation deleteWebhookSubscription
+ *
+ * Delete Webhook Subscription
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://api.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $id Webhook subscription ID (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteWebhookSubscription'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return \Bandwidth\Model\TfvError|null
+ */
+ public function deleteWebhookSubscription(
+ string $account_id,
+ string $id,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['deleteWebhookSubscription'][0]
+ ): ?\Bandwidth\Model\TfvError
+ {
+ list($response) = $this->deleteWebhookSubscriptionWithHttpInfo($account_id, $id, $hostIndex, $variables, $contentType);
+ return $response;
+ }
+
+ /**
+ * Operation deleteWebhookSubscriptionWithHttpInfo
+ *
+ * Delete Webhook Subscription
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://api.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $id Webhook subscription ID (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteWebhookSubscription'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return array{0: null, 1: int, 2: array} [response data, HTTP status code, HTTP response headers]
+ */
+ public function deleteWebhookSubscriptionWithHttpInfo(
+ string $account_id,
+ string $id,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['deleteWebhookSubscription'][0]
+ ): array
+ {
+ $request = $this->deleteWebhookSubscriptionRequest($account_id, $id, $hostIndex, $variables, $contentType);
+
+ try {
+ $options = $this->createHttpClientOption();
+ try {
+ $response = $this->client->send($request, $options);
+ } catch (RequestException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
+ $e->getResponse() ? (string) $e->getResponse()->getBody() : null
+ );
+ } catch (ConnectException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ null,
+ null
+ );
+ }
+
+ $statusCode = $response->getStatusCode();
+
+
+ return [null, $statusCode, $response->getHeaders()];
+ } catch (ApiException $e) {
+ switch ($e->getCode()) {
+ case 400:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\TfvError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 401:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\TfvError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 403:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\TfvError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 404:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\TfvError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 405:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\TfvError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 429:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\TfvError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 500:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\TfvError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 503:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\TfvError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ }
+
+ throw $e;
+ }
+ }
+
+ /**
+ * Operation deleteWebhookSubscriptionAsync
+ *
+ * Delete Webhook Subscription
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://api.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $id Webhook subscription ID (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteWebhookSubscription'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function deleteWebhookSubscriptionAsync(
+ string $account_id,
+ string $id,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['deleteWebhookSubscription'][0]
+ ): PromiseInterface
+ {
+ return $this->deleteWebhookSubscriptionAsyncWithHttpInfo($account_id, $id, $hostIndex, $variables, $contentType)
+ ->then(
+ function ($response) {
+ return $response[0];
+ }
+ );
+ }
+
+ /**
+ * Operation deleteWebhookSubscriptionAsyncWithHttpInfo
+ *
+ * Delete Webhook Subscription
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://api.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $id Webhook subscription ID (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteWebhookSubscription'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function deleteWebhookSubscriptionAsyncWithHttpInfo(
+ string $account_id,
+ string $id,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['deleteWebhookSubscription'][0]
+ ): PromiseInterface
+ {
+ $returnType = '';
+ $request = $this->deleteWebhookSubscriptionRequest($account_id, $id, $hostIndex, $variables, $contentType);
+
+ return $this->client
+ ->sendAsync($request, $this->createHttpClientOption())
+ ->then(
+ function ($response) use ($returnType) {
+ return [null, $response->getStatusCode(), $response->getHeaders()];
+ },
+ function ($exception) {
+ $response = $exception->getResponse();
+ $statusCode = $response->getStatusCode();
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ $exception->getRequest()->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+ );
+ }
+
+ /**
+ * Create request for operation 'deleteWebhookSubscription'
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://api.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $id Webhook subscription ID (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteWebhookSubscription'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return \GuzzleHttp\Psr7\Request
+ */
+ public function deleteWebhookSubscriptionRequest(
+ string $account_id,
+ string $id,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['deleteWebhookSubscription'][0]
+ ): Request
+ {
+ // verify the required parameter 'account_id' is set
+ if ($account_id === null || (is_array($account_id) && count($account_id) === 0)) {
+ throw new InvalidArgumentException(
+ 'Missing the required parameter $account_id when calling deleteWebhookSubscription'
+ );
+ }
+ // verify the required parameter 'id' is set
+ if ($id === null || (is_array($id) && count($id) === 0)) {
+ throw new InvalidArgumentException(
+ 'Missing the required parameter $id when calling deleteWebhookSubscription'
+ );
+ }
+
+ $resourcePath = '/accounts/{accountId}/tollFreeVerification/webhooks/subscriptions/{id}';
+ $queryParams = [];
+ $headerParams = [];
+ $httpBody = '';
+ $multipart = false;
+
+
+
+ // path params
+ if ($account_id !== null) {
+ $resourcePath = str_replace(
+ '{accountId}',
+ ObjectSerializer::toPathValue($account_id),
+ $resourcePath
+ );
+ }
+ // path params
+ if ($id !== null) {
+ $resourcePath = str_replace(
+ '{id}',
+ ObjectSerializer::toPathValue($id),
+ $resourcePath
+ );
+ }
+
+
+ $headers = $this->headerSelector->selectHeaders(
+ ['application/json', ],
+ $contentType,
+ $multipart
+ );
+
+
+ // this endpoint requires HTTP basic authentication
+ if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) {
+ $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword());
+ }
+
+ // this endpoint requires OAuth (access token)
+ if (!empty($this->config->getAccessToken())) {
+ $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken();
+ }
+
+ $defaultHeaders = [];
+ if ($this->config->getUserAgent()) {
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
+ }
+
+ $headers = array_merge(
+ $defaultHeaders,
+ $headerParams,
+ $headers
+ );
+
+ if ($this->config->getIgnoreOperationHosts()) {
+ $operationHost = $this->config->getHost();
+ } else {
+ # Preserve the original behavior of server indexing.
+ if ($hostIndex === null) {
+ $hostIndex = $this->hostIndex;
+ }
+
+ $hostSettings = $this->getHostSettingsFordeleteWebhookSubscription();
+
+ if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) {
+ throw new InvalidArgumentException("Invalid index {$hostIndex} when selecting the host. Must be less than ".count($hostSettings));
+ }
+ $operationHost = Configuration::getHostString($hostSettings, $hostIndex, $variables);
+ }
+ $query = ObjectSerializer::buildQuery($queryParams);
+ return new Request(
+ 'DELETE',
+ $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
+ $headers,
+ $httpBody
+ );
+ }
+
+ /**
+ * Returns an array of host settings for Operation deleteWebhookSubscription
+ *
+ * @return array an array of host settings
+ */
+ protected function getHostSettingsFordeleteWebhookSubscription(): array
+ {
+ return [
+ [
+ "url" => "https://api.bandwidth.com/api/v2",
+ "description" => "Production",
+ ]
+ ];
+ }
+
+ /**
+ * Operation getTollFreeVerificationStatus
+ *
+ * Get Toll-Free Verification Status
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://api.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $phone_number Valid Toll-Free telephone number in E.164 format. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTollFreeVerificationStatus'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return \Bandwidth\Model\TfvStatus|\Bandwidth\Model\TfvError
+ */
+ public function getTollFreeVerificationStatus(
+ string $account_id,
+ string $phone_number,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['getTollFreeVerificationStatus'][0]
+ ): \Bandwidth\Model\TfvStatus|\Bandwidth\Model\TfvError
+ {
+ list($response) = $this->getTollFreeVerificationStatusWithHttpInfo($account_id, $phone_number, $hostIndex, $variables, $contentType);
+ return $response;
+ }
+
+ /**
+ * Operation getTollFreeVerificationStatusWithHttpInfo
+ *
+ * Get Toll-Free Verification Status
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://api.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $phone_number Valid Toll-Free telephone number in E.164 format. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTollFreeVerificationStatus'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return array{0: \Bandwidth\Model\TfvStatus|\Bandwidth\Model\TfvError, 1: int, 2: array} [response data, HTTP status code, HTTP response headers]
+ */
+ public function getTollFreeVerificationStatusWithHttpInfo(
+ string $account_id,
+ string $phone_number,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['getTollFreeVerificationStatus'][0]
+ ): array
+ {
+ $request = $this->getTollFreeVerificationStatusRequest($account_id, $phone_number, $hostIndex, $variables, $contentType);
+
+ try {
+ $options = $this->createHttpClientOption();
+ try {
+ $response = $this->client->send($request, $options);
+ } catch (RequestException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
+ $e->getResponse() ? (string) $e->getResponse()->getBody() : null
+ );
+ } catch (ConnectException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ null,
+ null
+ );
+ }
+
+ $statusCode = $response->getStatusCode();
+
+ switch($statusCode) {
+ case 200:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\TfvStatus',
+ $request,
+ $response,
+ );
+ case 400:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\TfvError',
+ $request,
+ $response,
+ );
+ case 401:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\TfvError',
+ $request,
+ $response,
+ );
+ case 403:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\TfvError',
+ $request,
+ $response,
+ );
+ case 404:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\TfvError',
+ $request,
+ $response,
+ );
+ case 405:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\TfvError',
+ $request,
+ $response,
+ );
+ case 429:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\TfvError',
+ $request,
+ $response,
+ );
+ case 500:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\TfvError',
+ $request,
+ $response,
+ );
+ case 503:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\TfvError',
+ $request,
+ $response,
+ );
+ }
+
+ if ($statusCode < 200 || $statusCode > 299) {
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ (string) $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\TfvStatus',
+ $request,
+ $response,
+ );
+ } catch (ApiException $e) {
+ switch ($e->getCode()) {
+ case 200:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\TfvStatus',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 400:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\TfvError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 401:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\TfvError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 403:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\TfvError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 404:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\TfvError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 405:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\TfvError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 429:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\TfvError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 500:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\TfvError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 503:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\TfvError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ }
+
+ throw $e;
+ }
+ }
+
+ /**
+ * Operation getTollFreeVerificationStatusAsync
+ *
+ * Get Toll-Free Verification Status
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://api.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $phone_number Valid Toll-Free telephone number in E.164 format. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTollFreeVerificationStatus'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function getTollFreeVerificationStatusAsync(
+ string $account_id,
+ string $phone_number,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['getTollFreeVerificationStatus'][0]
+ ): PromiseInterface
+ {
+ return $this->getTollFreeVerificationStatusAsyncWithHttpInfo($account_id, $phone_number, $hostIndex, $variables, $contentType)
+ ->then(
+ function ($response) {
+ return $response[0];
+ }
+ );
+ }
+
+ /**
+ * Operation getTollFreeVerificationStatusAsyncWithHttpInfo
+ *
+ * Get Toll-Free Verification Status
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://api.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $phone_number Valid Toll-Free telephone number in E.164 format. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTollFreeVerificationStatus'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function getTollFreeVerificationStatusAsyncWithHttpInfo(
+ string $account_id,
+ string $phone_number,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['getTollFreeVerificationStatus'][0]
+ ): PromiseInterface
+ {
+ $returnType = '\Bandwidth\Model\TfvStatus';
+ $request = $this->getTollFreeVerificationStatusRequest($account_id, $phone_number, $hostIndex, $variables, $contentType);
+
+ return $this->client
+ ->sendAsync($request, $this->createHttpClientOption())
+ ->then(
+ function ($response) use ($returnType) {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ },
+ function ($exception) {
+ $response = $exception->getResponse();
+ $statusCode = $response->getStatusCode();
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ $exception->getRequest()->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+ );
+ }
+
+ /**
+ * Create request for operation 'getTollFreeVerificationStatus'
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://api.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $phone_number Valid Toll-Free telephone number in E.164 format. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTollFreeVerificationStatus'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return \GuzzleHttp\Psr7\Request
+ */
+ public function getTollFreeVerificationStatusRequest(
+ string $account_id,
+ string $phone_number,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['getTollFreeVerificationStatus'][0]
+ ): Request
+ {
+ // verify the required parameter 'account_id' is set
+ if ($account_id === null || (is_array($account_id) && count($account_id) === 0)) {
+ throw new InvalidArgumentException(
+ 'Missing the required parameter $account_id when calling getTollFreeVerificationStatus'
+ );
+ }
+ // verify the required parameter 'phone_number' is set
+ if ($phone_number === null || (is_array($phone_number) && count($phone_number) === 0)) {
+ throw new InvalidArgumentException(
+ 'Missing the required parameter $phone_number when calling getTollFreeVerificationStatus'
+ );
+ }
+ if (strlen($phone_number) > 12) {
+ throw new InvalidArgumentException('invalid length for "$phone_number" when calling TollFreeVerificationApi.getTollFreeVerificationStatus, must be smaller than or equal to 12.');
+ }
+ if (strlen($phone_number) < 12) {
+ throw new InvalidArgumentException('invalid length for "$phone_number" when calling TollFreeVerificationApi.getTollFreeVerificationStatus, must be bigger than or equal to 12.');
+ }
+ if (!preg_match("/^\\+1(800|833|844|855|866|877|888)[2-9]\\d{6}$/", $phone_number)) {
+ throw new InvalidArgumentException("invalid value for \"phone_number\" when calling TollFreeVerificationApi.getTollFreeVerificationStatus, must conform to the pattern /^\\+1(800|833|844|855|866|877|888)[2-9]\\d{6}$/.");
+ }
+
+ $resourcePath = '/accounts/{accountId}/phoneNumbers/{phoneNumber}/tollFreeVerification';
+ $queryParams = [];
+ $headerParams = [];
+ $httpBody = '';
+ $multipart = false;
+
+
+
+ // path params
+ if ($account_id !== null) {
+ $resourcePath = str_replace(
+ '{accountId}',
+ ObjectSerializer::toPathValue($account_id),
+ $resourcePath
+ );
+ }
+ // path params
+ if ($phone_number !== null) {
+ $resourcePath = str_replace(
+ '{phoneNumber}',
+ ObjectSerializer::toPathValue($phone_number),
+ $resourcePath
+ );
+ }
+
+
+ $headers = $this->headerSelector->selectHeaders(
+ ['application/json', ],
+ $contentType,
+ $multipart
+ );
+
+
+ // this endpoint requires HTTP basic authentication
+ if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) {
+ $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword());
+ }
+
+ // this endpoint requires OAuth (access token)
+ if (!empty($this->config->getAccessToken())) {
+ $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken();
+ }
+
+ $defaultHeaders = [];
+ if ($this->config->getUserAgent()) {
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
+ }
+
+ $headers = array_merge(
+ $defaultHeaders,
+ $headerParams,
+ $headers
+ );
+
+ if ($this->config->getIgnoreOperationHosts()) {
+ $operationHost = $this->config->getHost();
+ } else {
+ # Preserve the original behavior of server indexing.
+ if ($hostIndex === null) {
+ $hostIndex = $this->hostIndex;
+ }
+
+ $hostSettings = $this->getHostSettingsForgetTollFreeVerificationStatus();
+
+ if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) {
+ throw new InvalidArgumentException("Invalid index {$hostIndex} when selecting the host. Must be less than ".count($hostSettings));
+ }
+ $operationHost = Configuration::getHostString($hostSettings, $hostIndex, $variables);
+ }
+ $query = ObjectSerializer::buildQuery($queryParams);
+ return new Request(
+ 'GET',
+ $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
+ $headers,
+ $httpBody
+ );
+ }
+
+ /**
+ * Returns an array of host settings for Operation getTollFreeVerificationStatus
+ *
+ * @return array an array of host settings
+ */
+ protected function getHostSettingsForgetTollFreeVerificationStatus(): array
+ {
+ return [
+ [
+ "url" => "https://api.bandwidth.com/api/v2",
+ "description" => "Production",
+ ]
+ ];
+ }
+
+ /**
+ * Operation listTollFreeUseCases
+ *
+ * List Toll-Free Use Cases
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://api.bandwidth.com/api/v2
+ *
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listTollFreeUseCases'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return string[]|\Bandwidth\Model\TfvError
+ */
+ public function listTollFreeUseCases(
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['listTollFreeUseCases'][0]
+ ): array|\Bandwidth\Model\TfvError
+ {
+ list($response) = $this->listTollFreeUseCasesWithHttpInfo($hostIndex, $variables, $contentType);
+ return $response;
+ }
+
+ /**
+ * Operation listTollFreeUseCasesWithHttpInfo
+ *
+ * List Toll-Free Use Cases
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://api.bandwidth.com/api/v2
+ *
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listTollFreeUseCases'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return array{0: string[]|\Bandwidth\Model\TfvError, 1: int, 2: array} [response data, HTTP status code, HTTP response headers]
+ */
+ public function listTollFreeUseCasesWithHttpInfo(
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['listTollFreeUseCases'][0]
+ ): array
+ {
+ $request = $this->listTollFreeUseCasesRequest($hostIndex, $variables, $contentType);
+
+ try {
+ $options = $this->createHttpClientOption();
+ try {
+ $response = $this->client->send($request, $options);
+ } catch (RequestException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
+ $e->getResponse() ? (string) $e->getResponse()->getBody() : null
+ );
+ } catch (ConnectException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ null,
+ null
+ );
+ }
+
+ $statusCode = $response->getStatusCode();
+
+ switch($statusCode) {
+ case 200:
+ return $this->handleResponseWithDataType(
+ 'string[]',
+ $request,
+ $response,
+ );
+ case 400:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\TfvError',
+ $request,
+ $response,
+ );
+ case 401:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\TfvError',
+ $request,
+ $response,
+ );
+ case 403:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\TfvError',
+ $request,
+ $response,
+ );
+ case 404:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\TfvError',
+ $request,
+ $response,
+ );
+ case 405:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\TfvError',
+ $request,
+ $response,
+ );
+ case 429:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\TfvError',
+ $request,
+ $response,
+ );
+ case 500:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\TfvError',
+ $request,
+ $response,
+ );
+ case 503:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\TfvError',
+ $request,
+ $response,
+ );
+ }
+
+ if ($statusCode < 200 || $statusCode > 299) {
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ (string) $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+
+ return $this->handleResponseWithDataType(
+ 'string[]',
+ $request,
+ $response,
+ );
+ } catch (ApiException $e) {
+ switch ($e->getCode()) {
+ case 200:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ 'string[]',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 400:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\TfvError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 401:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\TfvError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 403:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\TfvError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 404:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\TfvError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 405:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\TfvError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 429:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\TfvError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 500:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\TfvError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 503:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\TfvError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ }
+
+ throw $e;
+ }
+ }
+
+ /**
+ * Operation listTollFreeUseCasesAsync
+ *
+ * List Toll-Free Use Cases
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://api.bandwidth.com/api/v2
+ *
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listTollFreeUseCases'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function listTollFreeUseCasesAsync(
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['listTollFreeUseCases'][0]
+ ): PromiseInterface
+ {
+ return $this->listTollFreeUseCasesAsyncWithHttpInfo($hostIndex, $variables, $contentType)
+ ->then(
+ function ($response) {
+ return $response[0];
+ }
+ );
+ }
+
+ /**
+ * Operation listTollFreeUseCasesAsyncWithHttpInfo
+ *
+ * List Toll-Free Use Cases
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://api.bandwidth.com/api/v2
+ *
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listTollFreeUseCases'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function listTollFreeUseCasesAsyncWithHttpInfo(
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['listTollFreeUseCases'][0]
+ ): PromiseInterface
+ {
+ $returnType = 'string[]';
+ $request = $this->listTollFreeUseCasesRequest($hostIndex, $variables, $contentType);
+
+ return $this->client
+ ->sendAsync($request, $this->createHttpClientOption())
+ ->then(
+ function ($response) use ($returnType) {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ },
+ function ($exception) {
+ $response = $exception->getResponse();
+ $statusCode = $response->getStatusCode();
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ $exception->getRequest()->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+ );
+ }
+
+ /**
+ * Create request for operation 'listTollFreeUseCases'
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://api.bandwidth.com/api/v2
+ *
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listTollFreeUseCases'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return \GuzzleHttp\Psr7\Request
+ */
+ public function listTollFreeUseCasesRequest(
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['listTollFreeUseCases'][0]
+ ): Request
+ {
+
+ $resourcePath = '/tollFreeVerification/useCases';
+ $queryParams = [];
+ $headerParams = [];
+ $httpBody = '';
+ $multipart = false;
+
+
+
+
+
+ $headers = $this->headerSelector->selectHeaders(
+ ['application/json', ],
+ $contentType,
+ $multipart
+ );
+
+
+ // this endpoint requires HTTP basic authentication
+ if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) {
+ $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword());
+ }
+
+ // this endpoint requires OAuth (access token)
+ if (!empty($this->config->getAccessToken())) {
+ $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken();
+ }
+
+ $defaultHeaders = [];
+ if ($this->config->getUserAgent()) {
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
+ }
+
+ $headers = array_merge(
+ $defaultHeaders,
+ $headerParams,
+ $headers
+ );
+
+ if ($this->config->getIgnoreOperationHosts()) {
+ $operationHost = $this->config->getHost();
+ } else {
+ # Preserve the original behavior of server indexing.
+ if ($hostIndex === null) {
+ $hostIndex = $this->hostIndex;
+ }
+
+ $hostSettings = $this->getHostSettingsForlistTollFreeUseCases();
+
+ if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) {
+ throw new InvalidArgumentException("Invalid index {$hostIndex} when selecting the host. Must be less than ".count($hostSettings));
+ }
+ $operationHost = Configuration::getHostString($hostSettings, $hostIndex, $variables);
+ }
+ $query = ObjectSerializer::buildQuery($queryParams);
+ return new Request(
+ 'GET',
+ $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
+ $headers,
+ $httpBody
+ );
+ }
+
+ /**
+ * Returns an array of host settings for Operation listTollFreeUseCases
+ *
+ * @return array an array of host settings
+ */
+ protected function getHostSettingsForlistTollFreeUseCases(): array
+ {
+ return [
+ [
+ "url" => "https://api.bandwidth.com/api/v2",
+ "description" => "Production",
+ ]
+ ];
+ }
+
+ /**
+ * Operation listWebhookSubscriptions
+ *
+ * List Webhook Subscriptions
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://api.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listWebhookSubscriptions'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return \Bandwidth\Model\WebhookSubscriptionsListBody|\Bandwidth\Model\TfvError
+ */
+ public function listWebhookSubscriptions(
+ string $account_id,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['listWebhookSubscriptions'][0]
+ ): \Bandwidth\Model\WebhookSubscriptionsListBody|\Bandwidth\Model\TfvError
+ {
+ list($response) = $this->listWebhookSubscriptionsWithHttpInfo($account_id, $hostIndex, $variables, $contentType);
+ return $response;
+ }
+
+ /**
+ * Operation listWebhookSubscriptionsWithHttpInfo
+ *
+ * List Webhook Subscriptions
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://api.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listWebhookSubscriptions'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return array{0: \Bandwidth\Model\WebhookSubscriptionsListBody|\Bandwidth\Model\TfvError, 1: int, 2: array} [response data, HTTP status code, HTTP response headers]
+ */
+ public function listWebhookSubscriptionsWithHttpInfo(
+ string $account_id,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['listWebhookSubscriptions'][0]
+ ): array
+ {
+ $request = $this->listWebhookSubscriptionsRequest($account_id, $hostIndex, $variables, $contentType);
+
+ try {
+ $options = $this->createHttpClientOption();
+ try {
+ $response = $this->client->send($request, $options);
+ } catch (RequestException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
+ $e->getResponse() ? (string) $e->getResponse()->getBody() : null
+ );
+ } catch (ConnectException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ null,
+ null
+ );
+ }
+
+ $statusCode = $response->getStatusCode();
+
+ switch($statusCode) {
+ case 200:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\WebhookSubscriptionsListBody',
+ $request,
+ $response,
+ );
+ case 400:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\TfvError',
+ $request,
+ $response,
+ );
+ case 401:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\TfvError',
+ $request,
+ $response,
+ );
+ case 403:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\TfvError',
+ $request,
+ $response,
+ );
+ case 405:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\TfvError',
+ $request,
+ $response,
+ );
+ case 429:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\TfvError',
+ $request,
+ $response,
+ );
+ case 500:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\TfvError',
+ $request,
+ $response,
+ );
+ case 503:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\TfvError',
+ $request,
+ $response,
+ );
+ }
+
+ if ($statusCode < 200 || $statusCode > 299) {
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ (string) $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\WebhookSubscriptionsListBody',
+ $request,
+ $response,
+ );
+ } catch (ApiException $e) {
+ switch ($e->getCode()) {
+ case 200:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\WebhookSubscriptionsListBody',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 400:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\TfvError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 401:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\TfvError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 403:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\TfvError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 405:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\TfvError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 429:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\TfvError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 500:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\TfvError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 503:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\TfvError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ }
+
+ throw $e;
+ }
+ }
+
+ /**
+ * Operation listWebhookSubscriptionsAsync
+ *
+ * List Webhook Subscriptions
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://api.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listWebhookSubscriptions'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function listWebhookSubscriptionsAsync(
+ string $account_id,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['listWebhookSubscriptions'][0]
+ ): PromiseInterface
+ {
+ return $this->listWebhookSubscriptionsAsyncWithHttpInfo($account_id, $hostIndex, $variables, $contentType)
+ ->then(
+ function ($response) {
+ return $response[0];
+ }
+ );
+ }
+
+ /**
+ * Operation listWebhookSubscriptionsAsyncWithHttpInfo
+ *
+ * List Webhook Subscriptions
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://api.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listWebhookSubscriptions'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function listWebhookSubscriptionsAsyncWithHttpInfo(
+ string $account_id,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['listWebhookSubscriptions'][0]
+ ): PromiseInterface
+ {
+ $returnType = '\Bandwidth\Model\WebhookSubscriptionsListBody';
+ $request = $this->listWebhookSubscriptionsRequest($account_id, $hostIndex, $variables, $contentType);
+
+ return $this->client
+ ->sendAsync($request, $this->createHttpClientOption())
+ ->then(
+ function ($response) use ($returnType) {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ },
+ function ($exception) {
+ $response = $exception->getResponse();
+ $statusCode = $response->getStatusCode();
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ $exception->getRequest()->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+ );
+ }
+
+ /**
+ * Create request for operation 'listWebhookSubscriptions'
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://api.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listWebhookSubscriptions'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return \GuzzleHttp\Psr7\Request
+ */
+ public function listWebhookSubscriptionsRequest(
+ string $account_id,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['listWebhookSubscriptions'][0]
+ ): Request
+ {
+ // verify the required parameter 'account_id' is set
+ if ($account_id === null || (is_array($account_id) && count($account_id) === 0)) {
+ throw new InvalidArgumentException(
+ 'Missing the required parameter $account_id when calling listWebhookSubscriptions'
+ );
+ }
+
+ $resourcePath = '/accounts/{accountId}/tollFreeVerification/webhooks/subscriptions';
+ $queryParams = [];
+ $headerParams = [];
+ $httpBody = '';
+ $multipart = false;
+
+
+
+ // path params
+ if ($account_id !== null) {
+ $resourcePath = str_replace(
+ '{accountId}',
+ ObjectSerializer::toPathValue($account_id),
+ $resourcePath
+ );
+ }
+
+
+ $headers = $this->headerSelector->selectHeaders(
+ ['application/json', ],
+ $contentType,
+ $multipart
+ );
+
+
+ // this endpoint requires HTTP basic authentication
+ if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) {
+ $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword());
+ }
+
+ // this endpoint requires OAuth (access token)
+ if (!empty($this->config->getAccessToken())) {
+ $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken();
+ }
+
+ $defaultHeaders = [];
+ if ($this->config->getUserAgent()) {
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
+ }
+
+ $headers = array_merge(
+ $defaultHeaders,
+ $headerParams,
+ $headers
+ );
+
+ if ($this->config->getIgnoreOperationHosts()) {
+ $operationHost = $this->config->getHost();
+ } else {
+ # Preserve the original behavior of server indexing.
+ if ($hostIndex === null) {
+ $hostIndex = $this->hostIndex;
+ }
+
+ $hostSettings = $this->getHostSettingsForlistWebhookSubscriptions();
+
+ if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) {
+ throw new InvalidArgumentException("Invalid index {$hostIndex} when selecting the host. Must be less than ".count($hostSettings));
+ }
+ $operationHost = Configuration::getHostString($hostSettings, $hostIndex, $variables);
+ }
+ $query = ObjectSerializer::buildQuery($queryParams);
+ return new Request(
+ 'GET',
+ $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
+ $headers,
+ $httpBody
+ );
+ }
+
+ /**
+ * Returns an array of host settings for Operation listWebhookSubscriptions
+ *
+ * @return array an array of host settings
+ */
+ protected function getHostSettingsForlistWebhookSubscriptions(): array
+ {
+ return [
+ [
+ "url" => "https://api.bandwidth.com/api/v2",
+ "description" => "Production",
+ ]
+ ];
+ }
+
+ /**
+ * Operation requestTollFreeVerification
+ *
+ * Request Toll-Free Verification
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://api.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param \Bandwidth\Model\VerificationRequest $verification_request Request for verification of a toll-free phone number. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['requestTollFreeVerification'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return \Bandwidth\Model\TfvError|null
+ */
+ public function requestTollFreeVerification(
+ string $account_id,
+ \Bandwidth\Model\VerificationRequest $verification_request,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['requestTollFreeVerification'][0]
+ ): ?\Bandwidth\Model\TfvError
+ {
+ list($response) = $this->requestTollFreeVerificationWithHttpInfo($account_id, $verification_request, $hostIndex, $variables, $contentType);
+ return $response;
+ }
+
+ /**
+ * Operation requestTollFreeVerificationWithHttpInfo
+ *
+ * Request Toll-Free Verification
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://api.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param \Bandwidth\Model\VerificationRequest $verification_request Request for verification of a toll-free phone number. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['requestTollFreeVerification'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return array{0: null, 1: int, 2: array} [response data, HTTP status code, HTTP response headers]
+ */
+ public function requestTollFreeVerificationWithHttpInfo(
+ string $account_id,
+ \Bandwidth\Model\VerificationRequest $verification_request,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['requestTollFreeVerification'][0]
+ ): array
+ {
+ $request = $this->requestTollFreeVerificationRequest($account_id, $verification_request, $hostIndex, $variables, $contentType);
+
+ try {
+ $options = $this->createHttpClientOption();
+ try {
+ $response = $this->client->send($request, $options);
+ } catch (RequestException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
+ $e->getResponse() ? (string) $e->getResponse()->getBody() : null
+ );
+ } catch (ConnectException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ null,
+ null
+ );
+ }
+
+ $statusCode = $response->getStatusCode();
+
+
+ return [null, $statusCode, $response->getHeaders()];
+ } catch (ApiException $e) {
+ switch ($e->getCode()) {
+ case 400:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\TfvError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 401:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\TfvError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 403:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\TfvError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 405:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\TfvError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 429:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\TfvError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 500:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\TfvError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 503:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\TfvError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ }
+
+ throw $e;
+ }
+ }
+
+ /**
+ * Operation requestTollFreeVerificationAsync
+ *
+ * Request Toll-Free Verification
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://api.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param \Bandwidth\Model\VerificationRequest $verification_request Request for verification of a toll-free phone number. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['requestTollFreeVerification'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function requestTollFreeVerificationAsync(
+ string $account_id,
+ \Bandwidth\Model\VerificationRequest $verification_request,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['requestTollFreeVerification'][0]
+ ): PromiseInterface
+ {
+ return $this->requestTollFreeVerificationAsyncWithHttpInfo($account_id, $verification_request, $hostIndex, $variables, $contentType)
+ ->then(
+ function ($response) {
+ return $response[0];
+ }
+ );
+ }
+
+ /**
+ * Operation requestTollFreeVerificationAsyncWithHttpInfo
+ *
+ * Request Toll-Free Verification
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://api.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param \Bandwidth\Model\VerificationRequest $verification_request Request for verification of a toll-free phone number. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['requestTollFreeVerification'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function requestTollFreeVerificationAsyncWithHttpInfo(
+ string $account_id,
+ \Bandwidth\Model\VerificationRequest $verification_request,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['requestTollFreeVerification'][0]
+ ): PromiseInterface
+ {
+ $returnType = '';
+ $request = $this->requestTollFreeVerificationRequest($account_id, $verification_request, $hostIndex, $variables, $contentType);
+
+ return $this->client
+ ->sendAsync($request, $this->createHttpClientOption())
+ ->then(
+ function ($response) use ($returnType) {
+ return [null, $response->getStatusCode(), $response->getHeaders()];
+ },
+ function ($exception) {
+ $response = $exception->getResponse();
+ $statusCode = $response->getStatusCode();
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ $exception->getRequest()->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+ );
+ }
+
+ /**
+ * Create request for operation 'requestTollFreeVerification'
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://api.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param \Bandwidth\Model\VerificationRequest $verification_request Request for verification of a toll-free phone number. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['requestTollFreeVerification'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return \GuzzleHttp\Psr7\Request
+ */
+ public function requestTollFreeVerificationRequest(
+ string $account_id,
+ \Bandwidth\Model\VerificationRequest $verification_request,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['requestTollFreeVerification'][0]
+ ): Request
+ {
+ // verify the required parameter 'account_id' is set
+ if ($account_id === null || (is_array($account_id) && count($account_id) === 0)) {
+ throw new InvalidArgumentException(
+ 'Missing the required parameter $account_id when calling requestTollFreeVerification'
+ );
+ }
+ // verify the required parameter 'verification_request' is set
+ if ($verification_request === null || (is_array($verification_request) && count($verification_request) === 0)) {
+ throw new InvalidArgumentException(
+ 'Missing the required parameter $verification_request when calling requestTollFreeVerification'
+ );
+ }
+
+ $resourcePath = '/accounts/{accountId}/tollFreeVerification';
+ $formParams = [];
+ $queryParams = [];
+ $headerParams = [];
+ $httpBody = '';
+ $multipart = false;
+
+
+
+ // path params
+ if ($account_id !== null) {
+ $resourcePath = str_replace(
+ '{accountId}',
+ ObjectSerializer::toPathValue($account_id),
+ $resourcePath
+ );
+ }
+
+
+ $headers = $this->headerSelector->selectHeaders(
+ ['application/json', ],
+ $contentType,
+ $multipart
+ );
+
+ // for model (json/xml)
+ if (isset($verification_request)) {
+ if (stripos($headers['Content-Type'], 'application/json') !== false) {
+ # if Content-Type contains "application/json", json_encode the body
+ $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($verification_request));
+ } else {
+ $httpBody = $verification_request;
+ }
+ } elseif (count($formParams) > 0) {
+ if ($multipart) {
+ $multipartContents = [];
+ foreach ($formParams as $formParamName => $formParamValue) {
+ $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
+ foreach ($formParamValueItems as $formParamValueItem) {
+ $multipartContents[] = [
+ 'name' => $formParamName,
+ 'contents' => $formParamValueItem
+ ];
+ }
+ }
+ // for HTTP post (form)
+ $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents);
+
+ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
+ # if Content-Type contains "application/json", json_encode the form parameters
+ $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams);
+ } else {
+ // for HTTP post (form)
+ $httpBody = ObjectSerializer::buildQuery($formParams);
+ }
+ }
+
+ // this endpoint requires HTTP basic authentication
+ if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) {
+ $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword());
+ }
+
+ // this endpoint requires OAuth (access token)
+ if (!empty($this->config->getAccessToken())) {
+ $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken();
+ }
+
+ $defaultHeaders = [];
+ if ($this->config->getUserAgent()) {
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
+ }
+
+ $headers = array_merge(
+ $defaultHeaders,
+ $headerParams,
+ $headers
+ );
+
+ if ($this->config->getIgnoreOperationHosts()) {
+ $operationHost = $this->config->getHost();
+ } else {
+ # Preserve the original behavior of server indexing.
+ if ($hostIndex === null) {
+ $hostIndex = $this->hostIndex;
+ }
+
+ $hostSettings = $this->getHostSettingsForrequestTollFreeVerification();
+
+ if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) {
+ throw new InvalidArgumentException("Invalid index {$hostIndex} when selecting the host. Must be less than ".count($hostSettings));
+ }
+ $operationHost = Configuration::getHostString($hostSettings, $hostIndex, $variables);
+ }
+ $query = ObjectSerializer::buildQuery($queryParams);
+ return new Request(
+ 'POST',
+ $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
+ $headers,
+ $httpBody
+ );
+ }
+
+ /**
+ * Returns an array of host settings for Operation requestTollFreeVerification
+ *
+ * @return array an array of host settings
+ */
+ protected function getHostSettingsForrequestTollFreeVerification(): array
+ {
+ return [
+ [
+ "url" => "https://api.bandwidth.com/api/v2",
+ "description" => "Production",
+ ]
+ ];
+ }
+
+ /**
+ * Operation updateTollFreeVerificationRequest
+ *
+ * Update Toll-Free Verification Request
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://api.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $phone_number Valid Toll-Free telephone number in E.164 format. (required)
+ * @param \Bandwidth\Model\TfvSubmissionWrapper $tfv_submission_wrapper Update a request for verification of a toll-free phone number. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateTollFreeVerificationRequest'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return \Bandwidth\Model\TfvError|null
+ */
+ public function updateTollFreeVerificationRequest(
+ string $account_id,
+ string $phone_number,
+ \Bandwidth\Model\TfvSubmissionWrapper $tfv_submission_wrapper,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['updateTollFreeVerificationRequest'][0]
+ ): ?\Bandwidth\Model\TfvError
+ {
+ list($response) = $this->updateTollFreeVerificationRequestWithHttpInfo($account_id, $phone_number, $tfv_submission_wrapper, $hostIndex, $variables, $contentType);
+ return $response;
+ }
+
+ /**
+ * Operation updateTollFreeVerificationRequestWithHttpInfo
+ *
+ * Update Toll-Free Verification Request
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://api.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $phone_number Valid Toll-Free telephone number in E.164 format. (required)
+ * @param \Bandwidth\Model\TfvSubmissionWrapper $tfv_submission_wrapper Update a request for verification of a toll-free phone number. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateTollFreeVerificationRequest'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return array{0: null, 1: int, 2: array} [response data, HTTP status code, HTTP response headers]
+ */
+ public function updateTollFreeVerificationRequestWithHttpInfo(
+ string $account_id,
+ string $phone_number,
+ \Bandwidth\Model\TfvSubmissionWrapper $tfv_submission_wrapper,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['updateTollFreeVerificationRequest'][0]
+ ): array
+ {
+ $request = $this->updateTollFreeVerificationRequestRequest($account_id, $phone_number, $tfv_submission_wrapper, $hostIndex, $variables, $contentType);
+
+ try {
+ $options = $this->createHttpClientOption();
+ try {
+ $response = $this->client->send($request, $options);
+ } catch (RequestException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
+ $e->getResponse() ? (string) $e->getResponse()->getBody() : null
+ );
+ } catch (ConnectException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ null,
+ null
+ );
+ }
+
+ $statusCode = $response->getStatusCode();
+
+
+ return [null, $statusCode, $response->getHeaders()];
+ } catch (ApiException $e) {
+ switch ($e->getCode()) {
+ case 400:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\TfvError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 401:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\TfvError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 403:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\TfvError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 405:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\TfvError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 429:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\TfvError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 500:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\TfvError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 503:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\TfvError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ }
+
+ throw $e;
+ }
+ }
+
+ /**
+ * Operation updateTollFreeVerificationRequestAsync
+ *
+ * Update Toll-Free Verification Request
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://api.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $phone_number Valid Toll-Free telephone number in E.164 format. (required)
+ * @param \Bandwidth\Model\TfvSubmissionWrapper $tfv_submission_wrapper Update a request for verification of a toll-free phone number. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateTollFreeVerificationRequest'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function updateTollFreeVerificationRequestAsync(
+ string $account_id,
+ string $phone_number,
+ \Bandwidth\Model\TfvSubmissionWrapper $tfv_submission_wrapper,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['updateTollFreeVerificationRequest'][0]
+ ): PromiseInterface
+ {
+ return $this->updateTollFreeVerificationRequestAsyncWithHttpInfo($account_id, $phone_number, $tfv_submission_wrapper, $hostIndex, $variables, $contentType)
+ ->then(
+ function ($response) {
+ return $response[0];
+ }
+ );
+ }
+
+ /**
+ * Operation updateTollFreeVerificationRequestAsyncWithHttpInfo
+ *
+ * Update Toll-Free Verification Request
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://api.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $phone_number Valid Toll-Free telephone number in E.164 format. (required)
+ * @param \Bandwidth\Model\TfvSubmissionWrapper $tfv_submission_wrapper Update a request for verification of a toll-free phone number. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateTollFreeVerificationRequest'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function updateTollFreeVerificationRequestAsyncWithHttpInfo(
+ string $account_id,
+ string $phone_number,
+ \Bandwidth\Model\TfvSubmissionWrapper $tfv_submission_wrapper,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['updateTollFreeVerificationRequest'][0]
+ ): PromiseInterface
+ {
+ $returnType = '';
+ $request = $this->updateTollFreeVerificationRequestRequest($account_id, $phone_number, $tfv_submission_wrapper, $hostIndex, $variables, $contentType);
+
+ return $this->client
+ ->sendAsync($request, $this->createHttpClientOption())
+ ->then(
+ function ($response) use ($returnType) {
+ return [null, $response->getStatusCode(), $response->getHeaders()];
+ },
+ function ($exception) {
+ $response = $exception->getResponse();
+ $statusCode = $response->getStatusCode();
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ $exception->getRequest()->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+ );
+ }
+
+ /**
+ * Create request for operation 'updateTollFreeVerificationRequest'
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://api.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $phone_number Valid Toll-Free telephone number in E.164 format. (required)
+ * @param \Bandwidth\Model\TfvSubmissionWrapper $tfv_submission_wrapper Update a request for verification of a toll-free phone number. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateTollFreeVerificationRequest'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return \GuzzleHttp\Psr7\Request
+ */
+ public function updateTollFreeVerificationRequestRequest(
+ string $account_id,
+ string $phone_number,
+ \Bandwidth\Model\TfvSubmissionWrapper $tfv_submission_wrapper,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['updateTollFreeVerificationRequest'][0]
+ ): Request
+ {
+ // verify the required parameter 'account_id' is set
+ if ($account_id === null || (is_array($account_id) && count($account_id) === 0)) {
+ throw new InvalidArgumentException(
+ 'Missing the required parameter $account_id when calling updateTollFreeVerificationRequest'
+ );
+ }
+ // verify the required parameter 'phone_number' is set
+ if ($phone_number === null || (is_array($phone_number) && count($phone_number) === 0)) {
+ throw new InvalidArgumentException(
+ 'Missing the required parameter $phone_number when calling updateTollFreeVerificationRequest'
+ );
+ }
+ if (strlen($phone_number) > 12) {
+ throw new InvalidArgumentException('invalid length for "$phone_number" when calling TollFreeVerificationApi.updateTollFreeVerificationRequest, must be smaller than or equal to 12.');
+ }
+ if (strlen($phone_number) < 12) {
+ throw new InvalidArgumentException('invalid length for "$phone_number" when calling TollFreeVerificationApi.updateTollFreeVerificationRequest, must be bigger than or equal to 12.');
+ }
+ if (!preg_match("/^\\+1(800|833|844|855|866|877|888)[2-9]\\d{6}$/", $phone_number)) {
+ throw new InvalidArgumentException("invalid value for \"phone_number\" when calling TollFreeVerificationApi.updateTollFreeVerificationRequest, must conform to the pattern /^\\+1(800|833|844|855|866|877|888)[2-9]\\d{6}$/.");
+ }
+ // verify the required parameter 'tfv_submission_wrapper' is set
+ if ($tfv_submission_wrapper === null || (is_array($tfv_submission_wrapper) && count($tfv_submission_wrapper) === 0)) {
+ throw new InvalidArgumentException(
+ 'Missing the required parameter $tfv_submission_wrapper when calling updateTollFreeVerificationRequest'
+ );
+ }
+
+ $resourcePath = '/accounts/{accountId}/phoneNumbers/{phoneNumber}/tollFreeVerification';
+ $formParams = [];
+ $queryParams = [];
+ $headerParams = [];
+ $httpBody = '';
+ $multipart = false;
+
+
+
+ // path params
+ if ($account_id !== null) {
+ $resourcePath = str_replace(
+ '{accountId}',
+ ObjectSerializer::toPathValue($account_id),
+ $resourcePath
+ );
+ }
+ // path params
+ if ($phone_number !== null) {
+ $resourcePath = str_replace(
+ '{phoneNumber}',
+ ObjectSerializer::toPathValue($phone_number),
+ $resourcePath
+ );
+ }
+
+
+ $headers = $this->headerSelector->selectHeaders(
+ ['application/json', ],
+ $contentType,
+ $multipart
+ );
+
+ // for model (json/xml)
+ if (isset($tfv_submission_wrapper)) {
+ if (stripos($headers['Content-Type'], 'application/json') !== false) {
+ # if Content-Type contains "application/json", json_encode the body
+ $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($tfv_submission_wrapper));
+ } else {
+ $httpBody = $tfv_submission_wrapper;
+ }
+ } elseif (count($formParams) > 0) {
+ if ($multipart) {
+ $multipartContents = [];
+ foreach ($formParams as $formParamName => $formParamValue) {
+ $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
+ foreach ($formParamValueItems as $formParamValueItem) {
+ $multipartContents[] = [
+ 'name' => $formParamName,
+ 'contents' => $formParamValueItem
+ ];
+ }
+ }
+ // for HTTP post (form)
+ $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents);
+
+ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
+ # if Content-Type contains "application/json", json_encode the form parameters
+ $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams);
+ } else {
+ // for HTTP post (form)
+ $httpBody = ObjectSerializer::buildQuery($formParams);
+ }
+ }
+
+ // this endpoint requires HTTP basic authentication
+ if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) {
+ $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword());
+ }
+
+ // this endpoint requires OAuth (access token)
+ if (!empty($this->config->getAccessToken())) {
+ $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken();
+ }
+
+ $defaultHeaders = [];
+ if ($this->config->getUserAgent()) {
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
+ }
+
+ $headers = array_merge(
+ $defaultHeaders,
+ $headerParams,
+ $headers
+ );
+
+ if ($this->config->getIgnoreOperationHosts()) {
+ $operationHost = $this->config->getHost();
+ } else {
+ # Preserve the original behavior of server indexing.
+ if ($hostIndex === null) {
+ $hostIndex = $this->hostIndex;
+ }
+
+ $hostSettings = $this->getHostSettingsForupdateTollFreeVerificationRequest();
+
+ if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) {
+ throw new InvalidArgumentException("Invalid index {$hostIndex} when selecting the host. Must be less than ".count($hostSettings));
+ }
+ $operationHost = Configuration::getHostString($hostSettings, $hostIndex, $variables);
+ }
+ $query = ObjectSerializer::buildQuery($queryParams);
+ return new Request(
+ 'PUT',
+ $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
+ $headers,
+ $httpBody
+ );
+ }
+
+ /**
+ * Returns an array of host settings for Operation updateTollFreeVerificationRequest
+ *
+ * @return array an array of host settings
+ */
+ protected function getHostSettingsForupdateTollFreeVerificationRequest(): array
+ {
+ return [
+ [
+ "url" => "https://api.bandwidth.com/api/v2",
+ "description" => "Production",
+ ]
+ ];
+ }
+
+ /**
+ * Operation updateWebhookSubscription
+ *
+ * Update Webhook Subscription
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://api.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $id Webhook subscription ID (required)
+ * @param \Bandwidth\Model\WebhookSubscriptionRequestSchema $webhook_subscription_request_schema Information about a webhook that Bandwidth should send upon the completion of event customer is trying to subscribe to. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateWebhookSubscription'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return \Bandwidth\Model\WebhookSubscription|\Bandwidth\Model\TfvError
+ */
+ public function updateWebhookSubscription(
+ string $account_id,
+ string $id,
+ \Bandwidth\Model\WebhookSubscriptionRequestSchema $webhook_subscription_request_schema,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['updateWebhookSubscription'][0]
+ ): \Bandwidth\Model\WebhookSubscription|\Bandwidth\Model\TfvError
+ {
+ list($response) = $this->updateWebhookSubscriptionWithHttpInfo($account_id, $id, $webhook_subscription_request_schema, $hostIndex, $variables, $contentType);
+ return $response;
+ }
+
+ /**
+ * Operation updateWebhookSubscriptionWithHttpInfo
+ *
+ * Update Webhook Subscription
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://api.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $id Webhook subscription ID (required)
+ * @param \Bandwidth\Model\WebhookSubscriptionRequestSchema $webhook_subscription_request_schema Information about a webhook that Bandwidth should send upon the completion of event customer is trying to subscribe to. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateWebhookSubscription'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return array{0: \Bandwidth\Model\WebhookSubscription|\Bandwidth\Model\TfvError, 1: int, 2: array} [response data, HTTP status code, HTTP response headers]
+ */
+ public function updateWebhookSubscriptionWithHttpInfo(
+ string $account_id,
+ string $id,
+ \Bandwidth\Model\WebhookSubscriptionRequestSchema $webhook_subscription_request_schema,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['updateWebhookSubscription'][0]
+ ): array
+ {
+ $request = $this->updateWebhookSubscriptionRequest($account_id, $id, $webhook_subscription_request_schema, $hostIndex, $variables, $contentType);
+
+ try {
+ $options = $this->createHttpClientOption();
+ try {
+ $response = $this->client->send($request, $options);
+ } catch (RequestException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
+ $e->getResponse() ? (string) $e->getResponse()->getBody() : null
+ );
+ } catch (ConnectException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ null,
+ null
+ );
+ }
+
+ $statusCode = $response->getStatusCode();
+
+ switch($statusCode) {
+ case 200:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\WebhookSubscription',
+ $request,
+ $response,
+ );
+ case 400:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\TfvError',
+ $request,
+ $response,
+ );
+ case 401:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\TfvError',
+ $request,
+ $response,
+ );
+ case 403:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\TfvError',
+ $request,
+ $response,
+ );
+ case 404:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\TfvError',
+ $request,
+ $response,
+ );
+ case 405:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\TfvError',
+ $request,
+ $response,
+ );
+ case 429:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\TfvError',
+ $request,
+ $response,
+ );
+ case 500:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\TfvError',
+ $request,
+ $response,
+ );
+ case 503:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\TfvError',
+ $request,
+ $response,
+ );
+ }
+
+ if ($statusCode < 200 || $statusCode > 299) {
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ (string) $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\WebhookSubscription',
+ $request,
+ $response,
+ );
+ } catch (ApiException $e) {
+ switch ($e->getCode()) {
+ case 200:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\WebhookSubscription',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 400:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\TfvError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 401:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\TfvError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 403:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\TfvError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 404:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\TfvError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 405:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\TfvError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 429:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\TfvError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 500:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\TfvError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 503:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\TfvError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ }
+
+ throw $e;
+ }
+ }
+
+ /**
+ * Operation updateWebhookSubscriptionAsync
+ *
+ * Update Webhook Subscription
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://api.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $id Webhook subscription ID (required)
+ * @param \Bandwidth\Model\WebhookSubscriptionRequestSchema $webhook_subscription_request_schema Information about a webhook that Bandwidth should send upon the completion of event customer is trying to subscribe to. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateWebhookSubscription'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function updateWebhookSubscriptionAsync(
+ string $account_id,
+ string $id,
+ \Bandwidth\Model\WebhookSubscriptionRequestSchema $webhook_subscription_request_schema,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['updateWebhookSubscription'][0]
+ ): PromiseInterface
+ {
+ return $this->updateWebhookSubscriptionAsyncWithHttpInfo($account_id, $id, $webhook_subscription_request_schema, $hostIndex, $variables, $contentType)
+ ->then(
+ function ($response) {
+ return $response[0];
+ }
+ );
+ }
+
+ /**
+ * Operation updateWebhookSubscriptionAsyncWithHttpInfo
+ *
+ * Update Webhook Subscription
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://api.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $id Webhook subscription ID (required)
+ * @param \Bandwidth\Model\WebhookSubscriptionRequestSchema $webhook_subscription_request_schema Information about a webhook that Bandwidth should send upon the completion of event customer is trying to subscribe to. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateWebhookSubscription'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function updateWebhookSubscriptionAsyncWithHttpInfo(
+ string $account_id,
+ string $id,
+ \Bandwidth\Model\WebhookSubscriptionRequestSchema $webhook_subscription_request_schema,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['updateWebhookSubscription'][0]
+ ): PromiseInterface
+ {
+ $returnType = '\Bandwidth\Model\WebhookSubscription';
+ $request = $this->updateWebhookSubscriptionRequest($account_id, $id, $webhook_subscription_request_schema, $hostIndex, $variables, $contentType);
+
+ return $this->client
+ ->sendAsync($request, $this->createHttpClientOption())
+ ->then(
+ function ($response) use ($returnType) {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ },
+ function ($exception) {
+ $response = $exception->getResponse();
+ $statusCode = $response->getStatusCode();
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ $exception->getRequest()->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+ );
+ }
+
+ /**
+ * Create request for operation 'updateWebhookSubscription'
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://api.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $id Webhook subscription ID (required)
+ * @param \Bandwidth\Model\WebhookSubscriptionRequestSchema $webhook_subscription_request_schema Information about a webhook that Bandwidth should send upon the completion of event customer is trying to subscribe to. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateWebhookSubscription'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return \GuzzleHttp\Psr7\Request
+ */
+ public function updateWebhookSubscriptionRequest(
+ string $account_id,
+ string $id,
+ \Bandwidth\Model\WebhookSubscriptionRequestSchema $webhook_subscription_request_schema,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['updateWebhookSubscription'][0]
+ ): Request
+ {
+ // verify the required parameter 'account_id' is set
+ if ($account_id === null || (is_array($account_id) && count($account_id) === 0)) {
+ throw new InvalidArgumentException(
+ 'Missing the required parameter $account_id when calling updateWebhookSubscription'
+ );
+ }
+ // verify the required parameter 'id' is set
+ if ($id === null || (is_array($id) && count($id) === 0)) {
+ throw new InvalidArgumentException(
+ 'Missing the required parameter $id when calling updateWebhookSubscription'
+ );
+ }
+ // verify the required parameter 'webhook_subscription_request_schema' is set
+ if ($webhook_subscription_request_schema === null || (is_array($webhook_subscription_request_schema) && count($webhook_subscription_request_schema) === 0)) {
+ throw new InvalidArgumentException(
+ 'Missing the required parameter $webhook_subscription_request_schema when calling updateWebhookSubscription'
+ );
+ }
+
+ $resourcePath = '/accounts/{accountId}/tollFreeVerification/webhooks/subscriptions/{id}';
+ $formParams = [];
+ $queryParams = [];
+ $headerParams = [];
+ $httpBody = '';
+ $multipart = false;
+
+
+
+ // path params
+ if ($account_id !== null) {
+ $resourcePath = str_replace(
+ '{accountId}',
+ ObjectSerializer::toPathValue($account_id),
+ $resourcePath
+ );
+ }
+ // path params
+ if ($id !== null) {
+ $resourcePath = str_replace(
+ '{id}',
+ ObjectSerializer::toPathValue($id),
+ $resourcePath
+ );
+ }
+
+
+ $headers = $this->headerSelector->selectHeaders(
+ ['application/json', ],
+ $contentType,
+ $multipart
+ );
+
+ // for model (json/xml)
+ if (isset($webhook_subscription_request_schema)) {
+ if (stripos($headers['Content-Type'], 'application/json') !== false) {
+ # if Content-Type contains "application/json", json_encode the body
+ $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($webhook_subscription_request_schema));
+ } else {
+ $httpBody = $webhook_subscription_request_schema;
+ }
+ } elseif (count($formParams) > 0) {
+ if ($multipart) {
+ $multipartContents = [];
+ foreach ($formParams as $formParamName => $formParamValue) {
+ $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
+ foreach ($formParamValueItems as $formParamValueItem) {
+ $multipartContents[] = [
+ 'name' => $formParamName,
+ 'contents' => $formParamValueItem
+ ];
+ }
+ }
+ // for HTTP post (form)
+ $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents);
+
+ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
+ # if Content-Type contains "application/json", json_encode the form parameters
+ $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams);
+ } else {
+ // for HTTP post (form)
+ $httpBody = ObjectSerializer::buildQuery($formParams);
+ }
+ }
+
+ // this endpoint requires HTTP basic authentication
+ if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) {
+ $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword());
+ }
+
+ // this endpoint requires OAuth (access token)
+ if (!empty($this->config->getAccessToken())) {
+ $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken();
+ }
+
+ $defaultHeaders = [];
+ if ($this->config->getUserAgent()) {
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
+ }
+
+ $headers = array_merge(
+ $defaultHeaders,
+ $headerParams,
+ $headers
+ );
+
+ if ($this->config->getIgnoreOperationHosts()) {
+ $operationHost = $this->config->getHost();
+ } else {
+ # Preserve the original behavior of server indexing.
+ if ($hostIndex === null) {
+ $hostIndex = $this->hostIndex;
+ }
+
+ $hostSettings = $this->getHostSettingsForupdateWebhookSubscription();
+
+ if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) {
+ throw new InvalidArgumentException("Invalid index {$hostIndex} when selecting the host. Must be less than ".count($hostSettings));
+ }
+ $operationHost = Configuration::getHostString($hostSettings, $hostIndex, $variables);
+ }
+ $query = ObjectSerializer::buildQuery($queryParams);
+ return new Request(
+ 'PUT',
+ $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
+ $headers,
+ $httpBody
+ );
+ }
+
+ /**
+ * Returns an array of host settings for Operation updateWebhookSubscription
+ *
+ * @return array an array of host settings
+ */
+ protected function getHostSettingsForupdateWebhookSubscription(): array
+ {
+ return [
+ [
+ "url" => "https://api.bandwidth.com/api/v2",
+ "description" => "Production",
+ ]
+ ];
+ }
+
+ /**
+ * Create http client option
+ *
+ * @throws \RuntimeException on file opening failure
+ * @return array of http client options
+ */
+ protected function createHttpClientOption(): array
+ {
+ $options = [];
+ if ($this->config->getDebug()) {
+ $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a');
+ if (!$options[RequestOptions::DEBUG]) {
+ throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile());
+ }
+ }
+
+ return $options;
+ }
+
+ private function handleResponseWithDataType(
+ string $dataType,
+ RequestInterface $request,
+ ResponseInterface $response,
+ ): array {
+ if (in_array($dataType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($dataType !== 'string') {
+ try {
+ $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR);
+ } catch (\JsonException $exception) {
+ throw new ApiException(
+ sprintf(
+ 'Error JSON decoding server response (%s)',
+ $request->getUri()
+ ),
+ $response->getStatusCode(),
+ $response->getHeaders(),
+ $content
+ );
+ }
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $dataType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ }
+
+ private function responseWithinRangeCode(
+ string $rangeCode,
+ int $statusCode,
+ ): bool {
+ $left = (int) ($rangeCode[0].'00');
+ $right = (int) ($rangeCode[0].'99');
+
+ return $statusCode >= $left && $statusCode <= $right;
+ }
+}
diff --git a/src/Api/TranscriptionsApi.php b/src/Api/TranscriptionsApi.php
new file mode 100644
index 0000000..424402d
--- /dev/null
+++ b/src/Api/TranscriptionsApi.php
@@ -0,0 +1,1546 @@
+ $contentTypes **/
+ public const contentTypes = [
+ 'deleteRealTimeTranscription' => [
+ 'application/json',
+ ],
+ 'getRealTimeTranscription' => [
+ 'application/json',
+ ],
+ 'listRealTimeTranscriptions' => [
+ 'application/json',
+ ],
+ ];
+
+ /**
+ * @param ClientInterface|null $client
+ * @param Configuration|null $config
+ * @param HeaderSelector|null $selector
+ * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec
+ */
+ public function __construct(
+ ?ClientInterface $client = null,
+ ?Configuration $config = null,
+ ?HeaderSelector $selector = null,
+ int $hostIndex = 0
+ ) {
+ $this->client = $client ?: new Client();
+ $this->config = $config ?: Configuration::getDefaultConfiguration();
+ $this->headerSelector = $selector ?: new HeaderSelector();
+ $this->hostIndex = $hostIndex;
+ }
+
+ /**
+ * Set the host index
+ *
+ * @param int $hostIndex Host index (required)
+ */
+ public function setHostIndex(int $hostIndex): void
+ {
+ $this->hostIndex = $hostIndex;
+ }
+
+ /**
+ * Get the host index
+ *
+ * @return int Host index
+ */
+ public function getHostIndex(): int
+ {
+ return $this->hostIndex;
+ }
+
+ /**
+ * @return Configuration
+ */
+ public function getConfig(): Configuration
+ {
+ return $this->config;
+ }
+
+ /**
+ * Operation deleteRealTimeTranscription
+ *
+ * Delete Real-time Transcription
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://voice.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $call_id Programmable Voice API Call ID. (required)
+ * @param string $transcription_id Programmable Voice API Transcription ID. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteRealTimeTranscription'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return \Bandwidth\Model\VoiceApiError|null
+ */
+ public function deleteRealTimeTranscription(
+ string $account_id,
+ string $call_id,
+ string $transcription_id,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['deleteRealTimeTranscription'][0]
+ ): ?\Bandwidth\Model\VoiceApiError
+ {
+ list($response) = $this->deleteRealTimeTranscriptionWithHttpInfo($account_id, $call_id, $transcription_id, $hostIndex, $variables, $contentType);
+ return $response;
+ }
+
+ /**
+ * Operation deleteRealTimeTranscriptionWithHttpInfo
+ *
+ * Delete Real-time Transcription
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://voice.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $call_id Programmable Voice API Call ID. (required)
+ * @param string $transcription_id Programmable Voice API Transcription ID. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteRealTimeTranscription'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return array{0: null, 1: int, 2: array} [response data, HTTP status code, HTTP response headers]
+ */
+ public function deleteRealTimeTranscriptionWithHttpInfo(
+ string $account_id,
+ string $call_id,
+ string $transcription_id,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['deleteRealTimeTranscription'][0]
+ ): array
+ {
+ $request = $this->deleteRealTimeTranscriptionRequest($account_id, $call_id, $transcription_id, $hostIndex, $variables, $contentType);
+
+ try {
+ $options = $this->createHttpClientOption();
+ try {
+ $response = $this->client->send($request, $options);
+ } catch (RequestException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
+ $e->getResponse() ? (string) $e->getResponse()->getBody() : null
+ );
+ } catch (ConnectException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ null,
+ null
+ );
+ }
+
+ $statusCode = $response->getStatusCode();
+
+
+ return [null, $statusCode, $response->getHeaders()];
+ } catch (ApiException $e) {
+ switch ($e->getCode()) {
+ case 400:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 401:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 403:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 404:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 405:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 415:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 429:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 500:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ }
+
+ throw $e;
+ }
+ }
+
+ /**
+ * Operation deleteRealTimeTranscriptionAsync
+ *
+ * Delete Real-time Transcription
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://voice.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $call_id Programmable Voice API Call ID. (required)
+ * @param string $transcription_id Programmable Voice API Transcription ID. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteRealTimeTranscription'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function deleteRealTimeTranscriptionAsync(
+ string $account_id,
+ string $call_id,
+ string $transcription_id,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['deleteRealTimeTranscription'][0]
+ ): PromiseInterface
+ {
+ return $this->deleteRealTimeTranscriptionAsyncWithHttpInfo($account_id, $call_id, $transcription_id, $hostIndex, $variables, $contentType)
+ ->then(
+ function ($response) {
+ return $response[0];
+ }
+ );
+ }
+
+ /**
+ * Operation deleteRealTimeTranscriptionAsyncWithHttpInfo
+ *
+ * Delete Real-time Transcription
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://voice.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $call_id Programmable Voice API Call ID. (required)
+ * @param string $transcription_id Programmable Voice API Transcription ID. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteRealTimeTranscription'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function deleteRealTimeTranscriptionAsyncWithHttpInfo(
+ string $account_id,
+ string $call_id,
+ string $transcription_id,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['deleteRealTimeTranscription'][0]
+ ): PromiseInterface
+ {
+ $returnType = '';
+ $request = $this->deleteRealTimeTranscriptionRequest($account_id, $call_id, $transcription_id, $hostIndex, $variables, $contentType);
+
+ return $this->client
+ ->sendAsync($request, $this->createHttpClientOption())
+ ->then(
+ function ($response) use ($returnType) {
+ return [null, $response->getStatusCode(), $response->getHeaders()];
+ },
+ function ($exception) {
+ $response = $exception->getResponse();
+ $statusCode = $response->getStatusCode();
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ $exception->getRequest()->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+ );
+ }
+
+ /**
+ * Create request for operation 'deleteRealTimeTranscription'
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://voice.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $call_id Programmable Voice API Call ID. (required)
+ * @param string $transcription_id Programmable Voice API Transcription ID. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteRealTimeTranscription'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return \GuzzleHttp\Psr7\Request
+ */
+ public function deleteRealTimeTranscriptionRequest(
+ string $account_id,
+ string $call_id,
+ string $transcription_id,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['deleteRealTimeTranscription'][0]
+ ): Request
+ {
+ // verify the required parameter 'account_id' is set
+ if ($account_id === null || (is_array($account_id) && count($account_id) === 0)) {
+ throw new InvalidArgumentException(
+ 'Missing the required parameter $account_id when calling deleteRealTimeTranscription'
+ );
+ }
+ // verify the required parameter 'call_id' is set
+ if ($call_id === null || (is_array($call_id) && count($call_id) === 0)) {
+ throw new InvalidArgumentException(
+ 'Missing the required parameter $call_id when calling deleteRealTimeTranscription'
+ );
+ }
+ // verify the required parameter 'transcription_id' is set
+ if ($transcription_id === null || (is_array($transcription_id) && count($transcription_id) === 0)) {
+ throw new InvalidArgumentException(
+ 'Missing the required parameter $transcription_id when calling deleteRealTimeTranscription'
+ );
+ }
+
+ $resourcePath = '/accounts/{accountId}/calls/{callId}/transcriptions/{transcriptionId}';
+ $queryParams = [];
+ $headerParams = [];
+ $httpBody = '';
+ $multipart = false;
+
+
+
+ // path params
+ if ($account_id !== null) {
+ $resourcePath = str_replace(
+ '{accountId}',
+ ObjectSerializer::toPathValue($account_id),
+ $resourcePath
+ );
+ }
+ // path params
+ if ($call_id !== null) {
+ $resourcePath = str_replace(
+ '{callId}',
+ ObjectSerializer::toPathValue($call_id),
+ $resourcePath
+ );
+ }
+ // path params
+ if ($transcription_id !== null) {
+ $resourcePath = str_replace(
+ '{transcriptionId}',
+ ObjectSerializer::toPathValue($transcription_id),
+ $resourcePath
+ );
+ }
+
+
+ $headers = $this->headerSelector->selectHeaders(
+ ['application/json', ],
+ $contentType,
+ $multipart
+ );
+
+
+ // this endpoint requires HTTP basic authentication
+ if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) {
+ $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword());
+ }
+
+ // this endpoint requires OAuth (access token)
+ if (!empty($this->config->getAccessToken())) {
+ $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken();
+ }
+
+ $defaultHeaders = [];
+ if ($this->config->getUserAgent()) {
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
+ }
+
+ $headers = array_merge(
+ $defaultHeaders,
+ $headerParams,
+ $headers
+ );
+
+ if ($this->config->getIgnoreOperationHosts()) {
+ $operationHost = $this->config->getHost();
+ } else {
+ # Preserve the original behavior of server indexing.
+ if ($hostIndex === null) {
+ $hostIndex = $this->hostIndex;
+ }
+
+ $hostSettings = $this->getHostSettingsFordeleteRealTimeTranscription();
+
+ if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) {
+ throw new InvalidArgumentException("Invalid index {$hostIndex} when selecting the host. Must be less than ".count($hostSettings));
+ }
+ $operationHost = Configuration::getHostString($hostSettings, $hostIndex, $variables);
+ }
+ $query = ObjectSerializer::buildQuery($queryParams);
+ return new Request(
+ 'DELETE',
+ $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
+ $headers,
+ $httpBody
+ );
+ }
+
+ /**
+ * Returns an array of host settings for Operation deleteRealTimeTranscription
+ *
+ * @return array an array of host settings
+ */
+ protected function getHostSettingsFordeleteRealTimeTranscription(): array
+ {
+ return [
+ [
+ "url" => "https://voice.bandwidth.com/api/v2",
+ "description" => "Production",
+ ]
+ ];
+ }
+
+ /**
+ * Operation getRealTimeTranscription
+ *
+ * Get Real-time Transcription
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://voice.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $call_id Programmable Voice API Call ID. (required)
+ * @param string $transcription_id Programmable Voice API Transcription ID. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getRealTimeTranscription'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return \Bandwidth\Model\CallTranscriptionResponse|\Bandwidth\Model\VoiceApiError
+ */
+ public function getRealTimeTranscription(
+ string $account_id,
+ string $call_id,
+ string $transcription_id,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['getRealTimeTranscription'][0]
+ ): \Bandwidth\Model\CallTranscriptionResponse|\Bandwidth\Model\VoiceApiError
+ {
+ list($response) = $this->getRealTimeTranscriptionWithHttpInfo($account_id, $call_id, $transcription_id, $hostIndex, $variables, $contentType);
+ return $response;
+ }
+
+ /**
+ * Operation getRealTimeTranscriptionWithHttpInfo
+ *
+ * Get Real-time Transcription
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://voice.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $call_id Programmable Voice API Call ID. (required)
+ * @param string $transcription_id Programmable Voice API Transcription ID. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getRealTimeTranscription'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return array{0: \Bandwidth\Model\CallTranscriptionResponse|\Bandwidth\Model\VoiceApiError, 1: int, 2: array} [response data, HTTP status code, HTTP response headers]
+ */
+ public function getRealTimeTranscriptionWithHttpInfo(
+ string $account_id,
+ string $call_id,
+ string $transcription_id,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['getRealTimeTranscription'][0]
+ ): array
+ {
+ $request = $this->getRealTimeTranscriptionRequest($account_id, $call_id, $transcription_id, $hostIndex, $variables, $contentType);
+
+ try {
+ $options = $this->createHttpClientOption();
+ try {
+ $response = $this->client->send($request, $options);
+ } catch (RequestException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
+ $e->getResponse() ? (string) $e->getResponse()->getBody() : null
+ );
+ } catch (ConnectException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ null,
+ null
+ );
+ }
+
+ $statusCode = $response->getStatusCode();
+
+ switch($statusCode) {
+ case 200:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\CallTranscriptionResponse',
+ $request,
+ $response,
+ );
+ case 400:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\VoiceApiError',
+ $request,
+ $response,
+ );
+ case 401:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\VoiceApiError',
+ $request,
+ $response,
+ );
+ case 403:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\VoiceApiError',
+ $request,
+ $response,
+ );
+ case 404:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\VoiceApiError',
+ $request,
+ $response,
+ );
+ case 405:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\VoiceApiError',
+ $request,
+ $response,
+ );
+ case 415:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\VoiceApiError',
+ $request,
+ $response,
+ );
+ case 429:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\VoiceApiError',
+ $request,
+ $response,
+ );
+ case 500:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\VoiceApiError',
+ $request,
+ $response,
+ );
+ }
+
+ if ($statusCode < 200 || $statusCode > 299) {
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ (string) $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\CallTranscriptionResponse',
+ $request,
+ $response,
+ );
+ } catch (ApiException $e) {
+ switch ($e->getCode()) {
+ case 200:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\CallTranscriptionResponse',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 400:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 401:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 403:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 404:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 405:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 415:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 429:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 500:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ }
+
+ throw $e;
+ }
+ }
+
+ /**
+ * Operation getRealTimeTranscriptionAsync
+ *
+ * Get Real-time Transcription
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://voice.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $call_id Programmable Voice API Call ID. (required)
+ * @param string $transcription_id Programmable Voice API Transcription ID. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getRealTimeTranscription'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function getRealTimeTranscriptionAsync(
+ string $account_id,
+ string $call_id,
+ string $transcription_id,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['getRealTimeTranscription'][0]
+ ): PromiseInterface
+ {
+ return $this->getRealTimeTranscriptionAsyncWithHttpInfo($account_id, $call_id, $transcription_id, $hostIndex, $variables, $contentType)
+ ->then(
+ function ($response) {
+ return $response[0];
+ }
+ );
+ }
+
+ /**
+ * Operation getRealTimeTranscriptionAsyncWithHttpInfo
+ *
+ * Get Real-time Transcription
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://voice.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $call_id Programmable Voice API Call ID. (required)
+ * @param string $transcription_id Programmable Voice API Transcription ID. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getRealTimeTranscription'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function getRealTimeTranscriptionAsyncWithHttpInfo(
+ string $account_id,
+ string $call_id,
+ string $transcription_id,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['getRealTimeTranscription'][0]
+ ): PromiseInterface
+ {
+ $returnType = '\Bandwidth\Model\CallTranscriptionResponse';
+ $request = $this->getRealTimeTranscriptionRequest($account_id, $call_id, $transcription_id, $hostIndex, $variables, $contentType);
+
+ return $this->client
+ ->sendAsync($request, $this->createHttpClientOption())
+ ->then(
+ function ($response) use ($returnType) {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ },
+ function ($exception) {
+ $response = $exception->getResponse();
+ $statusCode = $response->getStatusCode();
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ $exception->getRequest()->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+ );
+ }
+
+ /**
+ * Create request for operation 'getRealTimeTranscription'
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://voice.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $call_id Programmable Voice API Call ID. (required)
+ * @param string $transcription_id Programmable Voice API Transcription ID. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getRealTimeTranscription'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return \GuzzleHttp\Psr7\Request
+ */
+ public function getRealTimeTranscriptionRequest(
+ string $account_id,
+ string $call_id,
+ string $transcription_id,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['getRealTimeTranscription'][0]
+ ): Request
+ {
+ // verify the required parameter 'account_id' is set
+ if ($account_id === null || (is_array($account_id) && count($account_id) === 0)) {
+ throw new InvalidArgumentException(
+ 'Missing the required parameter $account_id when calling getRealTimeTranscription'
+ );
+ }
+ // verify the required parameter 'call_id' is set
+ if ($call_id === null || (is_array($call_id) && count($call_id) === 0)) {
+ throw new InvalidArgumentException(
+ 'Missing the required parameter $call_id when calling getRealTimeTranscription'
+ );
+ }
+ // verify the required parameter 'transcription_id' is set
+ if ($transcription_id === null || (is_array($transcription_id) && count($transcription_id) === 0)) {
+ throw new InvalidArgumentException(
+ 'Missing the required parameter $transcription_id when calling getRealTimeTranscription'
+ );
+ }
+
+ $resourcePath = '/accounts/{accountId}/calls/{callId}/transcriptions/{transcriptionId}';
+ $queryParams = [];
+ $headerParams = [];
+ $httpBody = '';
+ $multipart = false;
+
+
+
+ // path params
+ if ($account_id !== null) {
+ $resourcePath = str_replace(
+ '{accountId}',
+ ObjectSerializer::toPathValue($account_id),
+ $resourcePath
+ );
+ }
+ // path params
+ if ($call_id !== null) {
+ $resourcePath = str_replace(
+ '{callId}',
+ ObjectSerializer::toPathValue($call_id),
+ $resourcePath
+ );
+ }
+ // path params
+ if ($transcription_id !== null) {
+ $resourcePath = str_replace(
+ '{transcriptionId}',
+ ObjectSerializer::toPathValue($transcription_id),
+ $resourcePath
+ );
+ }
+
+
+ $headers = $this->headerSelector->selectHeaders(
+ ['application/json', ],
+ $contentType,
+ $multipart
+ );
+
+
+ // this endpoint requires HTTP basic authentication
+ if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) {
+ $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword());
+ }
+
+ // this endpoint requires OAuth (access token)
+ if (!empty($this->config->getAccessToken())) {
+ $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken();
+ }
+
+ $defaultHeaders = [];
+ if ($this->config->getUserAgent()) {
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
+ }
+
+ $headers = array_merge(
+ $defaultHeaders,
+ $headerParams,
+ $headers
+ );
+
+ if ($this->config->getIgnoreOperationHosts()) {
+ $operationHost = $this->config->getHost();
+ } else {
+ # Preserve the original behavior of server indexing.
+ if ($hostIndex === null) {
+ $hostIndex = $this->hostIndex;
+ }
+
+ $hostSettings = $this->getHostSettingsForgetRealTimeTranscription();
+
+ if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) {
+ throw new InvalidArgumentException("Invalid index {$hostIndex} when selecting the host. Must be less than ".count($hostSettings));
+ }
+ $operationHost = Configuration::getHostString($hostSettings, $hostIndex, $variables);
+ }
+ $query = ObjectSerializer::buildQuery($queryParams);
+ return new Request(
+ 'GET',
+ $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
+ $headers,
+ $httpBody
+ );
+ }
+
+ /**
+ * Returns an array of host settings for Operation getRealTimeTranscription
+ *
+ * @return array an array of host settings
+ */
+ protected function getHostSettingsForgetRealTimeTranscription(): array
+ {
+ return [
+ [
+ "url" => "https://voice.bandwidth.com/api/v2",
+ "description" => "Production",
+ ]
+ ];
+ }
+
+ /**
+ * Operation listRealTimeTranscriptions
+ *
+ * List Real-time Transcriptions
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://voice.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $call_id Programmable Voice API Call ID. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listRealTimeTranscriptions'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return \Bandwidth\Model\CallTranscriptionMetadata[]|\Bandwidth\Model\VoiceApiError
+ */
+ public function listRealTimeTranscriptions(
+ string $account_id,
+ string $call_id,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['listRealTimeTranscriptions'][0]
+ ): array|\Bandwidth\Model\VoiceApiError
+ {
+ list($response) = $this->listRealTimeTranscriptionsWithHttpInfo($account_id, $call_id, $hostIndex, $variables, $contentType);
+ return $response;
+ }
+
+ /**
+ * Operation listRealTimeTranscriptionsWithHttpInfo
+ *
+ * List Real-time Transcriptions
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://voice.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $call_id Programmable Voice API Call ID. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listRealTimeTranscriptions'] to see the possible values for this operation
+ *
+ * @throws ApiException on non-2xx response or if the response body is not in the expected format
+ * @throws InvalidArgumentException
+ * @return array{0: \Bandwidth\Model\CallTranscriptionMetadata[]|\Bandwidth\Model\VoiceApiError, 1: int, 2: array} [response data, HTTP status code, HTTP response headers]
+ */
+ public function listRealTimeTranscriptionsWithHttpInfo(
+ string $account_id,
+ string $call_id,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['listRealTimeTranscriptions'][0]
+ ): array
+ {
+ $request = $this->listRealTimeTranscriptionsRequest($account_id, $call_id, $hostIndex, $variables, $contentType);
+
+ try {
+ $options = $this->createHttpClientOption();
+ try {
+ $response = $this->client->send($request, $options);
+ } catch (RequestException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
+ $e->getResponse() ? (string) $e->getResponse()->getBody() : null
+ );
+ } catch (ConnectException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ null,
+ null
+ );
+ }
+
+ $statusCode = $response->getStatusCode();
+
+ switch($statusCode) {
+ case 200:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\CallTranscriptionMetadata[]',
+ $request,
+ $response,
+ );
+ case 400:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\VoiceApiError',
+ $request,
+ $response,
+ );
+ case 401:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\VoiceApiError',
+ $request,
+ $response,
+ );
+ case 403:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\VoiceApiError',
+ $request,
+ $response,
+ );
+ case 404:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\VoiceApiError',
+ $request,
+ $response,
+ );
+ case 405:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\VoiceApiError',
+ $request,
+ $response,
+ );
+ case 415:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\VoiceApiError',
+ $request,
+ $response,
+ );
+ case 429:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\VoiceApiError',
+ $request,
+ $response,
+ );
+ case 500:
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\VoiceApiError',
+ $request,
+ $response,
+ );
+ }
+
+ if ($statusCode < 200 || $statusCode > 299) {
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ (string) $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+
+ return $this->handleResponseWithDataType(
+ '\Bandwidth\Model\CallTranscriptionMetadata[]',
+ $request,
+ $response,
+ );
+ } catch (ApiException $e) {
+ switch ($e->getCode()) {
+ case 200:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\CallTranscriptionMetadata[]',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 400:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 401:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 403:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 404:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 405:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 415:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 429:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ case 500:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\Bandwidth\Model\VoiceApiError',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ throw $e;
+ }
+
+ throw $e;
+ }
+ }
+
+ /**
+ * Operation listRealTimeTranscriptionsAsync
+ *
+ * List Real-time Transcriptions
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://voice.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $call_id Programmable Voice API Call ID. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listRealTimeTranscriptions'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function listRealTimeTranscriptionsAsync(
+ string $account_id,
+ string $call_id,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['listRealTimeTranscriptions'][0]
+ ): PromiseInterface
+ {
+ return $this->listRealTimeTranscriptionsAsyncWithHttpInfo($account_id, $call_id, $hostIndex, $variables, $contentType)
+ ->then(
+ function ($response) {
+ return $response[0];
+ }
+ );
+ }
+
+ /**
+ * Operation listRealTimeTranscriptionsAsyncWithHttpInfo
+ *
+ * List Real-time Transcriptions
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://voice.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $call_id Programmable Voice API Call ID. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listRealTimeTranscriptions'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return PromiseInterface
+ */
+ public function listRealTimeTranscriptionsAsyncWithHttpInfo(
+ string $account_id,
+ string $call_id,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['listRealTimeTranscriptions'][0]
+ ): PromiseInterface
+ {
+ $returnType = '\Bandwidth\Model\CallTranscriptionMetadata[]';
+ $request = $this->listRealTimeTranscriptionsRequest($account_id, $call_id, $hostIndex, $variables, $contentType);
+
+ return $this->client
+ ->sendAsync($request, $this->createHttpClientOption())
+ ->then(
+ function ($response) use ($returnType) {
+ if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ },
+ function ($exception) {
+ $response = $exception->getResponse();
+ $statusCode = $response->getStatusCode();
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ $exception->getRequest()->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+ );
+ }
+
+ /**
+ * Create request for operation 'listRealTimeTranscriptions'
+ *
+ * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
+ * if needed, use the 'variables' parameter to pass variables to the host.
+ * URL: https://voice.bandwidth.com/api/v2
+ *
+ * @param string $account_id Your Bandwidth Account ID. (required)
+ * @param string $call_id Programmable Voice API Call ID. (required)
+ * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead
+ * @param array $variables Associative array of variables to pass to the host. Defaults to empty array.
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listRealTimeTranscriptions'] to see the possible values for this operation
+ *
+ * @throws InvalidArgumentException
+ * @return \GuzzleHttp\Psr7\Request
+ */
+ public function listRealTimeTranscriptionsRequest(
+ string $account_id,
+ string $call_id,
+ ?int $hostIndex = null,
+ array $variables = [],
+ string $contentType = self::contentTypes['listRealTimeTranscriptions'][0]
+ ): Request
+ {
+ // verify the required parameter 'account_id' is set
+ if ($account_id === null || (is_array($account_id) && count($account_id) === 0)) {
+ throw new InvalidArgumentException(
+ 'Missing the required parameter $account_id when calling listRealTimeTranscriptions'
+ );
+ }
+ // verify the required parameter 'call_id' is set
+ if ($call_id === null || (is_array($call_id) && count($call_id) === 0)) {
+ throw new InvalidArgumentException(
+ 'Missing the required parameter $call_id when calling listRealTimeTranscriptions'
+ );
+ }
+
+ $resourcePath = '/accounts/{accountId}/calls/{callId}/transcriptions';
+ $queryParams = [];
+ $headerParams = [];
+ $httpBody = '';
+ $multipart = false;
+
+
+
+ // path params
+ if ($account_id !== null) {
+ $resourcePath = str_replace(
+ '{accountId}',
+ ObjectSerializer::toPathValue($account_id),
+ $resourcePath
+ );
+ }
+ // path params
+ if ($call_id !== null) {
+ $resourcePath = str_replace(
+ '{callId}',
+ ObjectSerializer::toPathValue($call_id),
+ $resourcePath
+ );
+ }
+
+
+ $headers = $this->headerSelector->selectHeaders(
+ ['application/json', ],
+ $contentType,
+ $multipart
+ );
+
+
+ // this endpoint requires HTTP basic authentication
+ if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) {
+ $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword());
+ }
+
+ // this endpoint requires OAuth (access token)
+ if (!empty($this->config->getAccessToken())) {
+ $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken();
+ }
+
+ $defaultHeaders = [];
+ if ($this->config->getUserAgent()) {
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
+ }
+
+ $headers = array_merge(
+ $defaultHeaders,
+ $headerParams,
+ $headers
+ );
+
+ if ($this->config->getIgnoreOperationHosts()) {
+ $operationHost = $this->config->getHost();
+ } else {
+ # Preserve the original behavior of server indexing.
+ if ($hostIndex === null) {
+ $hostIndex = $this->hostIndex;
+ }
+
+ $hostSettings = $this->getHostSettingsForlistRealTimeTranscriptions();
+
+ if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) {
+ throw new InvalidArgumentException("Invalid index {$hostIndex} when selecting the host. Must be less than ".count($hostSettings));
+ }
+ $operationHost = Configuration::getHostString($hostSettings, $hostIndex, $variables);
+ }
+ $query = ObjectSerializer::buildQuery($queryParams);
+ return new Request(
+ 'GET',
+ $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
+ $headers,
+ $httpBody
+ );
+ }
+
+ /**
+ * Returns an array of host settings for Operation listRealTimeTranscriptions
+ *
+ * @return array an array of host settings
+ */
+ protected function getHostSettingsForlistRealTimeTranscriptions(): array
+ {
+ return [
+ [
+ "url" => "https://voice.bandwidth.com/api/v2",
+ "description" => "Production",
+ ]
+ ];
+ }
+
+ /**
+ * Create http client option
+ *
+ * @throws \RuntimeException on file opening failure
+ * @return array of http client options
+ */
+ protected function createHttpClientOption(): array
+ {
+ $options = [];
+ if ($this->config->getDebug()) {
+ $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a');
+ if (!$options[RequestOptions::DEBUG]) {
+ throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile());
+ }
+ }
+
+ return $options;
+ }
+
+ private function handleResponseWithDataType(
+ string $dataType,
+ RequestInterface $request,
+ ResponseInterface $response,
+ ): array {
+ if (in_array($dataType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($dataType !== 'string') {
+ try {
+ $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR);
+ } catch (\JsonException $exception) {
+ throw new ApiException(
+ sprintf(
+ 'Error JSON decoding server response (%s)',
+ $request->getUri()
+ ),
+ $response->getStatusCode(),
+ $response->getHeaders(),
+ $content
+ );
+ }
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $dataType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ }
+
+ private function responseWithinRangeCode(
+ string $rangeCode,
+ int $statusCode,
+ ): bool {
+ $left = (int) ($rangeCode[0].'00');
+ $right = (int) ($rangeCode[0].'99');
+
+ return $statusCode >= $left && $statusCode <= $right;
+ }
+}
diff --git a/src/BandwidthClient.php b/src/BandwidthClient.php
deleted file mode 100644
index 8e80179..0000000
--- a/src/BandwidthClient.php
+++ /dev/null
@@ -1,89 +0,0 @@
-config = $config;
- }
-
- private $messaging;
- private $multiFactorAuth;
- private $phoneNumberLookup;
- private $voice;
- private $webRtc;
-
- /**
- * Provides access to Messaging client
- * @return Messaging\MessagingClient
- */
- public function getMessaging()
- {
- if ($this->messaging == null) {
- $this->messaging = new Messaging\MessagingClient($this->config);
- }
- return $this->messaging;
- }
-
- /**
- * Provides access to MultiFactorAuth client
- * @return MultiFactorAuth\MultiFactorAuthClient
- */
- public function getMultiFactorAuth()
- {
- if ($this->multiFactorAuth == null) {
- $this->multiFactorAuth = new MultiFactorAuth\MultiFactorAuthClient($this->config);
- }
- return $this->multiFactorAuth;
- }
-
- /**
- * Provides access to PhoneNumberLookup client
- * @return PhoneNumberLookup\PhoneNumberLookupClient
- */
- public function getPhoneNumberLookup()
- {
- if ($this->phoneNumberLookup == null) {
- $this->phoneNumberLookup = new PhoneNumberLookup\PhoneNumberLookupClient($this->config);
- }
- return $this->phoneNumberLookup;
- }
-
- /**
- * Provides access to Voice client
- * @return Voice\VoiceClient
- */
- public function getVoice()
- {
- if ($this->voice == null) {
- $this->voice = new Voice\VoiceClient($this->config);
- }
- return $this->voice;
- }
-
- /**
- * Provides access to WebRtc client
- * @return WebRtc\WebRtcClient
- */
- public function getWebRtc()
- {
- if ($this->webRtc == null) {
- $this->webRtc = new WebRtc\WebRtcClient($this->config);
- }
- return $this->webRtc;
- }
-
-}
diff --git a/src/Configuration.php b/src/Configuration.php
index 2f25f72..7b638c8 100644
--- a/src/Configuration.php
+++ b/src/Configuration.php
@@ -1,384 +1,719 @@
tempFolderPath = sys_get_temp_dir();
+
+ // Default OAuth2 getter: reuses a cached token until it nears expiry,
+ // otherwise fetches a new one via the client credentials grant.
+ $this->accessTokenGetter = function (): string {
+ $tokenValid = $this->accessToken !== ''
+ && ($this->accessTokenExpiration === null || $this->accessTokenExpiration > time() + 60);
+ if ($tokenValid) {
+ return $this->accessToken;
+ }
+
+ // Fall back to the static token when client credentials aren't set
+ if ($this->clientId === '' || $this->clientSecret === '') {
+ return $this->accessToken;
+ }
+
+ $response = (new Client())->post($this->tokenUrl, [
+ 'headers' => [
+ 'Authorization' => 'Basic ' . base64_encode("{$this->clientId}:{$this->clientSecret}"),
+ 'Content-Type' => 'application/x-www-form-urlencoded',
+ ],
+ 'body' => 'grant_type=client_credentials',
+ 'http_errors' => false,
+ ]);
+
+ if ($response->getStatusCode() !== 200) {
+ throw new \RuntimeException(
+ "Failed to obtain access token: [{$response->getStatusCode()}] " . (string) $response->getBody()
+ );
+ }
+
+ $body = json_decode((string) $response->getBody(), true);
+ $this->accessToken = $body['access_token'];
+ $this->accessTokenExpiration = time() + $body['expires_in'];
+
+ return $this->accessToken;
+ };
+ }
/**
- * @todo Add description for parameter
- * @var string
+ * Sets API key
+ *
+ * @param string $apiKeyIdentifier API key identifier (authentication scheme)
+ * @param string $key API key or token
+ *
+ * @return $this
*/
- private $baseUrl = 'https://www.example.com';
+ public function setApiKey(string $apiKeyIdentifier, string $key): static
+ {
+ $this->apiKeys[$apiKeyIdentifier] = $key;
+ return $this;
+ }
- public function __construct($configOptions = null)
+ /**
+ * Gets API key
+ *
+ * @param string $apiKeyIdentifier API key identifier (authentication scheme)
+ *
+ * @return null|string API key or token
+ */
+ public function getApiKey(string $apiKeyIdentifier): ?string
{
- if (isset($configOptions['timeout'])) {
- $this->timeout = $configOptions['timeout'];
- }
- if (isset($configOptions['messagingBasicAuthUserName'])) {
- $this->messagingBasicAuthUserName = $configOptions['messagingBasicAuthUserName'];
- }
- if (isset($configOptions['messagingBasicAuthPassword'])) {
- $this->messagingBasicAuthPassword = $configOptions['messagingBasicAuthPassword'];
- }
- if (isset($configOptions['multiFactorAuthBasicAuthUserName'])) {
- $this->multiFactorAuthBasicAuthUserName = $configOptions['multiFactorAuthBasicAuthUserName'];
- }
- if (isset($configOptions['multiFactorAuthBasicAuthPassword'])) {
- $this->multiFactorAuthBasicAuthPassword = $configOptions['multiFactorAuthBasicAuthPassword'];
- }
- if (isset($configOptions['phoneNumberLookupBasicAuthUserName'])) {
- $this->phoneNumberLookupBasicAuthUserName = $configOptions['phoneNumberLookupBasicAuthUserName'];
- }
- if (isset($configOptions['phoneNumberLookupBasicAuthPassword'])) {
- $this->phoneNumberLookupBasicAuthPassword = $configOptions['phoneNumberLookupBasicAuthPassword'];
- }
- if (isset($configOptions['voiceBasicAuthUserName'])) {
- $this->voiceBasicAuthUserName = $configOptions['voiceBasicAuthUserName'];
- }
- if (isset($configOptions['voiceBasicAuthPassword'])) {
- $this->voiceBasicAuthPassword = $configOptions['voiceBasicAuthPassword'];
- }
- if (isset($configOptions['webRtcBasicAuthUserName'])) {
- $this->webRtcBasicAuthUserName = $configOptions['webRtcBasicAuthUserName'];
- }
- if (isset($configOptions['webRtcBasicAuthPassword'])) {
- $this->webRtcBasicAuthPassword = $configOptions['webRtcBasicAuthPassword'];
- }
- if (isset($configOptions['clientId'])) {
- $this->clientId = $configOptions['clientId'];
- }
- if (isset($configOptions['clientSecret'])) {
- $this->clientSecret = $configOptions['clientSecret'];
- }
- if (isset($configOptions['accessToken'])) {
- $this->accessToken = $configOptions['accessToken'];
- }
- if (isset($configOptions['accessTokenExpiration'])) {
- $this->accessTokenExpiration = $configOptions['accessTokenExpiration'];
- }
- if (isset($configOptions['environment'])) {
- $this->environment = $configOptions['environment'];
- }
- if (isset($configOptions['baseUrl'])) {
- $this->baseUrl = $configOptions['baseUrl'];
- }
+ return $this->apiKeys[$apiKeyIdentifier] ?? null;
+ }
+
+ /**
+ * Sets the prefix for API key (e.g. Bearer)
+ *
+ * @param string $apiKeyIdentifier API key identifier (authentication scheme)
+ * @param string $prefix API key prefix, e.g. Bearer
+ *
+ * @return $this
+ */
+ public function setApiKeyPrefix(string $apiKeyIdentifier, string $prefix): static
+ {
+ $this->apiKeyPrefixes[$apiKeyIdentifier] = $prefix;
+ return $this;
}
- public function getConfigurationMap()
+ /**
+ * Gets API key prefix
+ *
+ * @param string $apiKeyIdentifier API key identifier (authentication scheme)
+ *
+ * @return null|string
+ */
+ public function getApiKeyPrefix(string $apiKeyIdentifier): ?string
{
- $configMap = array();
+ return $this->apiKeyPrefixes[$apiKeyIdentifier] ?? null;
+ }
- if (isset($this->timeout)) {
- $configMap['timeout'] = $this->timeout;
- }
- if (isset($this->messagingBasicAuthUserName)) {
- $configMap['messagingBasicAuthUserName'] = $this->messagingBasicAuthUserName;
- }
- if (isset($this->messagingBasicAuthPassword)) {
- $configMap['messagingBasicAuthPassword'] = $this->messagingBasicAuthPassword;
- }
- if (isset($this->multiFactorAuthBasicAuthUserName)) {
- $configMap['multiFactorAuthBasicAuthUserName'] = $this->multiFactorAuthBasicAuthUserName;
- }
- if (isset($this->multiFactorAuthBasicAuthPassword)) {
- $configMap['multiFactorAuthBasicAuthPassword'] = $this->multiFactorAuthBasicAuthPassword;
- }
- if (isset($this->phoneNumberLookupBasicAuthUserName)) {
- $configMap['phoneNumberLookupBasicAuthUserName'] = $this->phoneNumberLookupBasicAuthUserName;
- }
- if (isset($this->phoneNumberLookupBasicAuthPassword)) {
- $configMap['phoneNumberLookupBasicAuthPassword'] = $this->phoneNumberLookupBasicAuthPassword;
- }
- if (isset($this->voiceBasicAuthUserName)) {
- $configMap['voiceBasicAuthUserName'] = $this->voiceBasicAuthUserName;
- }
- if (isset($this->voiceBasicAuthPassword)) {
- $configMap['voiceBasicAuthPassword'] = $this->voiceBasicAuthPassword;
- }
- if (isset($this->webRtcBasicAuthUserName)) {
- $configMap['webRtcBasicAuthUserName'] = $this->webRtcBasicAuthUserName;
- }
- if (isset($this->webRtcBasicAuthPassword)) {
- $configMap['webRtcBasicAuthPassword'] = $this->webRtcBasicAuthPassword;
- }
- if (isset($this->clientId)) {
- $configMap['clientId'] = $this->clientId;
- }
- if (isset($this->clientSecret)) {
- $configMap['clientSecret'] = $this->clientSecret;
- }
- if (isset($this->accessToken)) {
- $configMap['accessToken'] = $this->accessToken;
- }
- if (isset($this->accessTokenExpiration)) {
- $configMap['accessTokenExpiration'] = $this->accessTokenExpiration;
- }
- if (isset($this->environment)) {
- $configMap['environment'] = $this->environment;
- }
- if (isset($this->baseUrl)) {
- $configMap['baseUrl'] = $this->baseUrl;
+ /**
+ * Sets the access token for OAuth
+ *
+ * @param string $accessToken Token for OAuth
+ *
+ * @return $this
+ */
+ public function setAccessToken(string $accessToken): static
+ {
+ $this->accessToken = $accessToken;
+ return $this;
+ }
+
+ /**
+ * Gets the access token for OAuth
+ *
+ * Delegates to the access token getter when set, which may fetch or refresh
+ * the token (and can therefore perform a network request). Falls back to the
+ * static access token otherwise.
+ *
+ * @return string Access token for OAuth
+ */
+ public function getAccessToken(): string
+ {
+ if ($this->accessTokenGetter !== null) {
+ return ($this->accessTokenGetter)() ?? '';
}
+ return $this->accessToken;
+ }
- return $configMap;
+ /**
+ * Sets the client ID for OAuth2 client credentials authentication
+ *
+ * @param string $clientId Client ID for OAuth2
+ *
+ * @return $this
+ */
+ public function setClientId(string $clientId): static
+ {
+ $this->clientId = $clientId;
+ return $this;
}
- // Getter for timeout
- public function getTimeout()
+ /**
+ * Gets the client ID for OAuth2 client credentials authentication
+ *
+ * @return string Client ID for OAuth2
+ */
+ public function getClientId(): string
{
- return $this->timeout;
+ return $this->clientId;
}
- // Getter for messagingBasicAuthUserName
- public function getMessagingBasicAuthUserName()
+ /**
+ * Sets the client secret for OAuth2 client credentials authentication
+ *
+ * @param string $clientSecret Client secret for OAuth2
+ *
+ * @return $this
+ */
+ public function setClientSecret(string $clientSecret): static
{
- return $this->messagingBasicAuthUserName;
+ $this->clientSecret = $clientSecret;
+ return $this;
}
- // Getter for messagingBasicAuthPassword
- public function getMessagingBasicAuthPassword()
+ /**
+ * Gets the client secret for OAuth2 client credentials authentication
+ *
+ * @return string Client secret for OAuth2
+ */
+ public function getClientSecret(): string
{
- return $this->messagingBasicAuthPassword;
+ return $this->clientSecret;
}
- // Getter for multiFactorAuthBasicAuthUserName
- public function getMultiFactorAuthBasicAuthUserName()
+ /**
+ * Sets the token endpoint used to fetch an OAuth2 access token
+ *
+ * @param string $tokenUrl Token endpoint URL
+ *
+ * @return $this
+ */
+ public function setTokenUrl(string $tokenUrl): static
{
- return $this->multiFactorAuthBasicAuthUserName;
+ $this->tokenUrl = $tokenUrl;
+ return $this;
}
- // Getter for multiFactorAuthBasicAuthPassword
- public function getMultiFactorAuthBasicAuthPassword()
+ /**
+ * Gets the token endpoint used to fetch an OAuth2 access token
+ *
+ * @return string Token endpoint URL
+ */
+ public function getTokenUrl(): string
{
- return $this->multiFactorAuthBasicAuthPassword;
+ return $this->tokenUrl;
}
- // Getter for phoneNumberLookupBasicAuthUserName
- public function getPhoneNumberLookupBasicAuthUserName()
+ /**
+ * Sets the access token getter. Set to null to use the static access token.
+ *
+ * @param \Closure|null $accessTokenGetter Callable returning a valid access token
+ *
+ * @return $this
+ */
+ public function setAccessTokenGetter(?\Closure $accessTokenGetter): static
{
- return $this->phoneNumberLookupBasicAuthUserName;
+ $this->accessTokenGetter = $accessTokenGetter;
+ return $this;
}
- // Getter for phoneNumberLookupBasicAuthPassword
- public function getPhoneNumberLookupBasicAuthPassword()
+ /**
+ * Sets boolean format for query string.
+ *
+ * @param string $booleanFormat Boolean format for query string
+ *
+ * @return $this
+ */
+ public function setBooleanFormatForQueryString(string $booleanFormat): static
{
- return $this->phoneNumberLookupBasicAuthPassword;
+ $this->booleanFormatForQueryString = $booleanFormat;
+
+ return $this;
}
- // Getter for voiceBasicAuthUserName
- public function getVoiceBasicAuthUserName()
+ /**
+ * Gets boolean format for query string.
+ *
+ * @return string Boolean format for query string
+ */
+ public function getBooleanFormatForQueryString(): string
{
- return $this->voiceBasicAuthUserName;
+ return $this->booleanFormatForQueryString;
}
- // Getter for voiceBasicAuthPassword
- public function getVoiceBasicAuthPassword()
+ /**
+ * Sets the username for HTTP basic authentication
+ *
+ * @param string $username Username for HTTP basic authentication
+ *
+ * @return $this
+ */
+ public function setUsername(string $username): static
{
- return $this->voiceBasicAuthPassword;
+ $this->username = $username;
+ return $this;
}
- // Getter for webRtcBasicAuthUserName
- public function getWebRtcBasicAuthUserName()
+ /**
+ * Gets the username for HTTP basic authentication
+ *
+ * @return string Username for HTTP basic authentication
+ */
+ public function getUsername(): string
{
- return $this->webRtcBasicAuthUserName;
+ return $this->username;
}
- // Getter for webRtcBasicAuthPassword
- public function getWebRtcBasicAuthPassword()
+ /**
+ * Sets the password for HTTP basic authentication
+ *
+ * @param string $password Password for HTTP basic authentication
+ *
+ * @return $this
+ */
+ public function setPassword(string $password): static
{
- return $this->webRtcBasicAuthPassword;
+ $this->password = $password;
+ return $this;
}
- // Getter for clientId
- public function getClientId()
+ /**
+ * Gets the password for HTTP basic authentication
+ *
+ * @return string Password for HTTP basic authentication
+ */
+ public function getPassword(): string
{
- return $this->clientId;
+ return $this->password;
}
- // Getter for clientSecret
- public function getClientSecret()
+ /**
+ * Sets the host
+ *
+ * @param string $host Host
+ *
+ * @return $this
+ */
+ public function setHost(string $host): static
{
- return $this->clientSecret;
+ $this->host = $host;
+ return $this;
}
- // Getter for accessToken
- public function getAccessToken()
+ /**
+ * Gets the host
+ *
+ * @return string Host
+ */
+ public function getHost(): string
{
- return $this->accessToken;
+ return $this->host;
}
- // Setter for accessToken
- public function setAccessToken($value)
+ /**
+ * Sets the user agent of the api client
+ *
+ * @param string $userAgent the user agent of the api client
+ *
+ * @throws InvalidArgumentException
+ * @return $this
+ */
+ public function setUserAgent(string $userAgent): static
{
- $this->accessToken = $value;
+ $this->userAgent = $userAgent;
+ return $this;
}
- // Getter for getAccessTokenExpiration
- public function getAccessTokenExpiration()
+ /**
+ * Gets the user agent of the api client
+ *
+ * @return string user agent
+ */
+ public function getUserAgent(): string
{
- return $this->accessTokenExpiration;
+ return $this->userAgent;
}
- // Setter for accessTokenExpiration
- public function setAccessTokenExpiration($value)
+ /**
+ * Sets debug flag
+ *
+ * @param bool $debug Debug flag
+ *
+ * @return $this
+ */
+ public function setDebug(bool $debug): static
+ {
+ $this->debug = $debug;
+ return $this;
+ }
+
+ /**
+ * Gets the debug flag
+ *
+ * @return bool
+ */
+ public function getDebug(): bool
+ {
+ return $this->debug;
+ }
+
+ /**
+ * Sets the debug file
+ *
+ * @param string $debugFile Debug file
+ *
+ * @return $this
+ */
+ public function setDebugFile(string $debugFile): static
+ {
+ $this->debugFile = $debugFile;
+ return $this;
+ }
+
+ /**
+ * Gets the debug file
+ *
+ * @return string
+ */
+ public function getDebugFile(): string
{
- $this->accessTokenExpiration = $value;
+ return $this->debugFile;
}
- // Getter for environment
- public function getEnvironment()
+ /**
+ * Sets the temp folder path
+ *
+ * @param string $tempFolderPath Temp folder path
+ *
+ * @return $this
+ */
+ public function setTempFolderPath(string $tempFolderPath): static
{
- return $this->environment;
+ $this->tempFolderPath = $tempFolderPath;
+ return $this;
}
- // Getter for baseUrl
- public function getBaseUrl()
+ /**
+ * Gets the temp folder path
+ *
+ * @return string Temp folder path
+ */
+ public function getTempFolderPath(): string
{
- return $this->baseUrl;
+ return $this->tempFolderPath;
}
/**
- * Get the base uri for a given server in the current environment
- * @param string $server Server name
- * @return string Base URI
+ * Sets the ignore operation specific hosts flag
+ *
+ * @param bool $ignoreOperationHosts Ignore operation specific hosts flag
+ *
+ * @return $this
*/
- public function getBaseUri(string $server = Servers::DEFAULT_)
+ public function setIgnoreOperationHosts(bool $ignoreOperationHosts): static
{
- return APIHelper::appendUrlWithTemplateParameters(
- static::$environmentsMap[$this->environment][$server],
- array(
- 'base_url' => $this->baseUrl,
- ),
- false
- );
+ $this->ignoreOperationHosts = $ignoreOperationHosts;
+ return $this;
}
/**
- * A map of all baseurls used in different environments and servers
- * @var array
+ * Gets the ignore operation specific hosts flag
+ *
+ * @return bool Ignore operation specific hosts flag
*/
- private static $environmentsMap = array(
- Environments::PRODUCTION => array(
- Servers::DEFAULT_ => 'api.bandwidth.com',
- Servers::MESSAGINGDEFAULT => 'https://messaging.bandwidth.com/api/v2',
- Servers::MULTIFACTORAUTHDEFAULT => 'https://mfa.bandwidth.com/api/v1',
- Servers::PHONENUMBERLOOKUPDEFAULT => 'https://api.bandwidth.com/v2',
- Servers::VOICEDEFAULT => 'https://voice.bandwidth.com',
- Servers::WEBRTCDEFAULT => 'https://api.webrtc.bandwidth.com/v1',
- ),
- Environments::CUSTOM => array(
- Servers::DEFAULT_ => '{base_url}',
- Servers::MESSAGINGDEFAULT => '{base_url}',
- Servers::MULTIFACTORAUTHDEFAULT => '{base_url}',
- Servers::PHONENUMBERLOOKUPDEFAULT => '{base_url}',
- Servers::VOICEDEFAULT => '{base_url}',
- Servers::WEBRTCDEFAULT => '{base_url}',
- ),
- );
+ public function getIgnoreOperationHosts(): bool
+ {
+ return $this->ignoreOperationHosts;
+ }
+
+ /**
+ * Gets the default configuration instance
+ *
+ * @return Configuration
+ */
+ public static function getDefaultConfiguration(): Configuration
+ {
+ if (self::$defaultConfiguration === null) {
+ self::$defaultConfiguration = new Configuration();
+ }
+
+ return self::$defaultConfiguration;
+ }
+
+ /**
+ * Sets the default configuration instance
+ *
+ * @param Configuration $config An instance of the Configuration Object
+ *
+ * @return void
+ */
+ public static function setDefaultConfiguration(Configuration $config): void
+ {
+ self::$defaultConfiguration = $config;
+ }
+
+ /**
+ * Gets the essential information for debugging
+ *
+ * @return string The report for debugging
+ */
+ public static function toDebugReport(): string
+ {
+ $report = 'PHP SDK (Bandwidth) Debug Report:' . PHP_EOL;
+ $report .= ' OS: ' . php_uname() . PHP_EOL;
+ $report .= ' PHP Version: ' . PHP_VERSION . PHP_EOL;
+ $report .= ' The version of the OpenAPI document: 1.0.0' . PHP_EOL;
+ $report .= ' Temp Folder Path: ' . self::getDefaultConfiguration()->getTempFolderPath() . PHP_EOL;
+
+ return $report;
+ }
+
+ /**
+ * Get API key (with prefix if set)
+ *
+ * @param string $apiKeyIdentifier name of apikey
+ *
+ * @return null|string API key with the prefix
+ */
+ public function getApiKeyWithPrefix(string $apiKeyIdentifier): ?string
+ {
+ $prefix = $this->getApiKeyPrefix($apiKeyIdentifier);
+ $apiKey = $this->getApiKey($apiKeyIdentifier);
+
+ if ($apiKey === null) {
+ return null;
+ }
+
+ if ($prefix === null) {
+ $keyWithPrefix = $apiKey;
+ } else {
+ $keyWithPrefix = $prefix . ' ' . $apiKey;
+ }
+
+ return $keyWithPrefix;
+ }
+
+ /**
+ * Returns an array of host settings
+ *
+ * @return array an array of host settings
+ */
+ public function getHostSettings(): array
+ {
+ return [
+ [
+ "url" => "",
+ "description" => "No description provided",
+ ]
+ ];
+ }
+
+ /**
+ * Returns URL based on host settings, index and variables
+ *
+ * @param array $hostSettings array of host settings, generated from getHostSettings() or equivalent from the API clients
+ * @param int $hostIndex index of the host settings
+ * @param array|null $variables hash of variable and the corresponding value (optional)
+ * @return string URL based on host settings
+ */
+ public static function getHostString(array $hostSettings, int $hostIndex, ?array $variables = null): string
+ {
+ if (null === $variables) {
+ $variables = [];
+ }
+
+ // check array index out of bound
+ if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) {
+ throw new InvalidArgumentException("Invalid index $hostIndex when selecting the host. Must be less than ".count($hostSettings));
+ }
+
+ $host = $hostSettings[$hostIndex];
+ $url = $host["url"];
+
+ // go through variable and assign a value
+ foreach ($host["variables"] ?? [] as $name => $variable) {
+ if (array_key_exists($name, $variables)) { // check to see if it's in the variables provided by the user
+ if (!isset($variable['enum_values']) || in_array($variables[$name], $variable["enum_values"], true)) { // check to see if the value is in the enum
+ $url = str_replace("{".$name."}", $variables[$name], $url);
+ } else {
+ throw new InvalidArgumentException("The variable `$name` in the host URL has invalid value ".$variables[$name].". Must be ".join(',', $variable["enum_values"]).".");
+ }
+ } else {
+ // use default value
+ $url = str_replace("{".$name."}", $variable["default_value"], $url);
+ }
+ }
+
+ return $url;
+ }
+
+ /**
+ * Returns URL based on the index and variables
+ *
+ * @param int $index index of the host settings
+ * @param array|null $variables hash of variable and the corresponding value (optional)
+ * @return string URL based on host settings
+ */
+ public function getHostFromSettings(int $index, ?array $variables = null): string
+ {
+ return self::getHostString($this->getHostSettings(), $index, $variables);
+ }
}
diff --git a/src/Controllers/BaseController.php b/src/Controllers/BaseController.php
deleted file mode 100644
index 7a41cc3..0000000
--- a/src/Controllers/BaseController.php
+++ /dev/null
@@ -1,141 +0,0 @@
-config = $config;
-
- if (isset($httpCallBack)) {
- $this->httpCallBack = $httpCallBack;
- }
- }
-
- /**
- * Get HttpCallBack for this controller
- * @return HttpCallBack The HttpCallBack object set for this controller
- */
- public function getHttpCallBack()
- {
- return $this->httpCallBack;
- }
-
- /**
- * Get a new JsonMapper instance for mapping objects
- * @return \apimatic\jsonmapper\JsonMapper JsonMapper instance
- */
- protected function getJsonMapper()
- {
- $mapper = new JsonMapper();
- return $mapper;
- }
-
- protected function validateResponse(HttpResponse $response, HttpContext $_httpContext)
- {
- if (($response->getStatusCode() < 200) || ($response->getStatusCode() > 208)) { //[200,208] = HTTP OK
- throw new APIException('HTTP Response Not OK', $_httpContext);
- }
- }
-
- /**
- * Update Auth for an HTTP request based on the current configuration
- * @param array $headers The headers for the request
- * @param string $authType The type of basic auth to use
- */
- protected function configureAuth(&$headers, $authType)
- {
- if (!empty($this->config->getAccessToken()) &&
- (empty($this->config->getAccessTokenExpiration()) ||
- $this->config->getAccessTokenExpiration() > time() + 60)
- ) {
- $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken();
- return;
- }
-
- if (!empty($this->config->getClientId()) && !empty($this->config->getClientSecret())) {
- $_tokenUrl = 'https://api.bandwidth.com/api/v1/oauth2/token';
- $_tokenHeaders = array (
- 'User-Agent' => BaseController::USER_AGENT,
- 'Content-Type' => 'application/x-www-form-urlencoded',
- 'Authorization' => 'Basic ' . base64_encode(
- $this->config->getClientId() . ':' . $this->config->getClientSecret()
- )
- );
- $_tokenBody = Request\Body::Form([
- 'grant_type' => 'client_credentials'
- ]);
- $response = Request::post($_tokenUrl, $_tokenHeaders, $_tokenBody);
- $this->config->setAccessToken($response->body->access_token);
- $this->config->setAccessTokenExpiration(time() + $response->body->expires_in);
- $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken();
-
- return;
- }
-
- $username = '';
- $password = '';
-
- switch ($authType) {
- case 'messaging':
- $username = $this->config->getMessagingBasicAuthUserName();
- $password = $this->config->getMessagingBasicAuthPassword();
- break;
- case 'voice':
- $username = $this->config->getVoiceBasicAuthUserName();
- $password = $this->config->getVoiceBasicAuthPassword();
- break;
- case 'webrtc':
- $username = $this->config->getWebRtcBasicAuthUserName();
- $password = $this->config->getWebRtcBasicAuthPassword();
- break;
- case 'phoneNumberLookup':
- $username = $this->config->getPhoneNumberLookupBasicAuthUserName();
- $password = $this->config->getPhoneNumberLookupBasicAuthPassword();
- break;
- case 'multiFactorAuth':
- $username = $this->config->getMultiFactorAuthBasicAuthUserName();
- $password = $this->config->getMultiFactorAuthBasicAuthPassword();
- break;
- }
-
- Request::auth($username, $password);
- }
-}
diff --git a/src/Environments.php b/src/Environments.php
deleted file mode 100644
index 418ec49..0000000
--- a/src/Environments.php
+++ /dev/null
@@ -1,24 +0,0 @@
- $values the value of the form parameter
+ *
+ * @return array [key => value] of formdata
+ */
+ public function prepare(array $values): array
+ {
+ $this->has_file = false;
+ $result = [];
+
+ foreach ($values as $k => $v) {
+ if ($v === null) {
+ continue;
+ }
+
+ $result[$k] = $this->makeFormSafe($v);
+ }
+
+ return $result;
+ }
+
+ /**
+ * Flattens a multi-level array of data and generates a single-level array
+ * compatible with formdata - a single-level array where the keys use bracket
+ * notation to signify nested data.
+ *
+ * credit: https://github.com/FranBar1966/FlatPHP
+ */
+ public static function flatten(array $source, string $start = ''): array
+ {
+ $opt = [
+ 'prefix' => '[',
+ 'suffix' => ']',
+ 'suffix-end' => true,
+ 'prefix-list' => '[',
+ 'suffix-list' => ']',
+ 'suffix-list-end' => true,
+ ];
+
+ if ($start === '') {
+ $currentPrefix = '';
+ $currentSuffix = '';
+ $currentSuffixEnd = false;
+ } elseif (array_is_list($source)) {
+ $currentPrefix = $opt['prefix-list'];
+ $currentSuffix = $opt['suffix-list'];
+ $currentSuffixEnd = $opt['suffix-list-end'];
+ } else {
+ $currentPrefix = $opt['prefix'];
+ $currentSuffix = $opt['suffix'];
+ $currentSuffixEnd = $opt['suffix-end'];
+ }
+
+ $currentName = $start;
+ $result = [];
+
+ foreach ($source as $key => $val) {
+ $currentName .= $currentPrefix . $key;
+
+ if (is_array($val) && !empty($val)) {
+ $currentName .= $currentSuffix;
+ $result += self::flatten($val, $currentName);
+ } else {
+ if ($currentSuffixEnd) {
+ $currentName .= $currentSuffix;
+ }
+
+ if (is_resource($val)) {
+ $result[$currentName] = $val;
+ } else {
+ $result[$currentName] = ObjectSerializer::toString($val);
+ }
+ }
+
+ $currentName = $start;
+ }
+
+ return $result;
+ }
+
+ /**
+ * formdata must be limited to scalars or arrays of scalar values,
+ * or a resource for a file upload. Here we iterate through all available
+ * data and identify how to handle each scenario
+ *
+ * @param string|bool|array|DateTime|ArrayAccess|SplFileObject $value
+ */
+ protected function makeFormSafe(mixed $value)
+ {
+ if ($value instanceof SplFileObject) {
+ return $this->processFiles([$value])[0];
+ }
+
+ if (is_resource($value)) {
+ $this->has_file = true;
+
+ return $value;
+ }
+
+ if ($value instanceof ModelInterface) {
+ return $this->processModel($value);
+ }
+
+ if (is_array($value) || is_object($value)) {
+ $data = [];
+
+ foreach ($value as $k => $v) {
+ $data[$k] = $this->makeFormSafe($v);
+ }
+
+ return $data;
+ }
+
+ return ObjectSerializer::toString($value);
+ }
+
+ /**
+ * We are able to handle nested ModelInterface. We do not simply call
+ * json_decode(json_encode()) because any given model may have binary data
+ * or other data that cannot be serialized to a JSON string
+ */
+ protected function processModel(ModelInterface $model): array
+ {
+ $result = [];
+
+ foreach ($model::openAPITypes() as $name => $type) {
+ $value = $model->offsetGet($name);
+
+ if ($value === null) {
+ continue;
+ }
+
+ if (str_contains($type, '\SplFileObject')) {
+ $file = is_array($value) ? $value : [$value];
+ $result[$name] = $this->processFiles($file);
+
+ continue;
+ }
+
+ if ($value instanceof ModelInterface) {
+ $result[$name] = $this->processModel($value);
+
+ continue;
+ }
+
+ if (is_array($value) || is_object($value)) {
+ $result[$name] = $this->makeFormSafe($value);
+
+ continue;
+ }
+
+ $result[$name] = ObjectSerializer::toString($value);
+ }
+
+ return $result;
+ }
+
+ /**
+ * Handle file data
+ */
+ protected function processFiles(array $files): array
+ {
+ $this->has_file = true;
+
+ $result = [];
+
+ foreach ($files as $i => $file) {
+ if (is_array($file)) {
+ $result[$i] = $this->processFiles($file);
+
+ continue;
+ }
+
+ if ($file instanceof StreamInterface) {
+ $result[$i] = $file;
+
+ continue;
+ }
+
+ if ($file instanceof SplFileObject) {
+ $result[$i] = $this->tryFopen($file);
+ }
+ }
+
+ return $result;
+ }
+
+ private function tryFopen(SplFileObject $file)
+ {
+ return Utils::tryFopen($file->getRealPath(), 'rb');
+ }
+}
diff --git a/src/HeaderSelector.php b/src/HeaderSelector.php
new file mode 100644
index 0000000..4884754
--- /dev/null
+++ b/src/HeaderSelector.php
@@ -0,0 +1,244 @@
+selectAcceptHeader($accept);
+ if ($accept !== null) {
+ $headers['Accept'] = $accept;
+ }
+
+ if (!$isMultipart) {
+ if($contentType === '') {
+ $contentType = 'application/json';
+ }
+
+ $headers['Content-Type'] = $contentType;
+ }
+
+ return $headers;
+ }
+
+ /**
+ * Return the header 'Accept' based on an array of Accept provided.
+ *
+ * @param string[] $accept Array of header
+ *
+ * @return null|string Accept (e.g. application/json)
+ */
+ private function selectAcceptHeader(array $accept): ?string
+ {
+ # filter out empty entries
+ $accept = array_filter($accept);
+
+ if (count($accept) === 0) {
+ return null;
+ }
+
+ # If there's only one Accept header, just use it
+ if (count($accept) === 1) {
+ return reset($accept);
+ }
+
+ # If none of the available Accept headers is of type "json", then just use all them
+ $headersWithJson = preg_grep('~(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$~', $accept);
+ if (count($headersWithJson) === 0) {
+ return implode(',', $accept);
+ }
+
+ # If we got here, then we need add quality values (weight), as described in IETF RFC 9110, Items 12.4.2/12.5.1,
+ # to give the highest priority to json-like headers - recalculating the existing ones, if needed
+ return $this->getAcceptHeaderWithAdjustedWeight($accept, $headersWithJson);
+ }
+
+ /**
+ * Create an Accept header string from the given "Accept" headers array, recalculating all weights
+ *
+ * @param string[] $accept Array of Accept Headers
+ * @param string[] $headersWithJson Array of Accept Headers of type "json"
+ *
+ * @return string "Accept" Header (e.g. "application/json, text/html; q=0.9")
+ */
+ private function getAcceptHeaderWithAdjustedWeight(array $accept, array $headersWithJson): string
+ {
+ $processedHeaders = [
+ 'withApplicationJson' => [],
+ 'withJson' => [],
+ 'withoutJson' => [],
+ ];
+
+ foreach ($accept as $header) {
+
+ $headerData = $this->getHeaderAndWeight($header);
+
+ if (stripos($headerData['header'], 'application/json') === 0) {
+ $processedHeaders['withApplicationJson'][] = $headerData;
+ } elseif (in_array($header, $headersWithJson, true)) {
+ $processedHeaders['withJson'][] = $headerData;
+ } else {
+ $processedHeaders['withoutJson'][] = $headerData;
+ }
+ }
+
+ $acceptHeaders = [];
+ $currentWeight = 1000;
+
+ $hasMoreThan28Headers = count($accept) > 28;
+
+ foreach($processedHeaders as $headers) {
+ if (count($headers) > 0) {
+ $acceptHeaders[] = $this->adjustWeight($headers, $currentWeight, $hasMoreThan28Headers);
+ }
+ }
+
+ $acceptHeaders = array_merge(...$acceptHeaders);
+
+ return implode(',', $acceptHeaders);
+ }
+
+ /**
+ * Given an Accept header, returns an associative array splitting the header and its weight
+ *
+ * @param string $header "Accept" Header
+ *
+ * @return array with the header and its weight
+ */
+ private function getHeaderAndWeight(string $header): array
+ {
+ # matches headers with weight, splitting the header and the weight in $outputArray
+ if (preg_match('/(.*);\s*q=(1(?:\.0+)?|0\.\d+)$/', $header, $outputArray) === 1) {
+ $headerData = [
+ 'header' => $outputArray[1],
+ 'weight' => (int)($outputArray[2] * 1000),
+ ];
+ } else {
+ $headerData = [
+ 'header' => trim($header),
+ 'weight' => 1000,
+ ];
+ }
+
+ return $headerData;
+ }
+
+ /**
+ * @param array[] $headers
+ * @param float $currentWeight
+ * @param bool $hasMoreThan28Headers
+ * @return string[] array of adjusted "Accept" headers
+ */
+ private function adjustWeight(array $headers, float &$currentWeight, bool $hasMoreThan28Headers): array
+ {
+ usort($headers, function (array $a, array $b) {
+ return $b['weight'] - $a['weight'];
+ });
+
+ $acceptHeaders = [];
+ foreach ($headers as $index => $header) {
+ if($index > 0 && $headers[$index - 1]['weight'] > $header['weight'])
+ {
+ $currentWeight = $this->getNextWeight($currentWeight, $hasMoreThan28Headers);
+ }
+
+ $weight = $currentWeight;
+
+ $acceptHeaders[] = $this->buildAcceptHeader($header['header'], $weight);
+ }
+
+ $currentWeight = $this->getNextWeight($currentWeight, $hasMoreThan28Headers);
+
+ return $acceptHeaders;
+ }
+
+ /**
+ * @param string $header
+ * @param int $weight
+ * @return string
+ */
+ private function buildAcceptHeader(string $header, int $weight): string
+ {
+ if($weight === 1000) {
+ return $header;
+ }
+
+ return trim($header, '; ') . ';q=' . rtrim(sprintf('%0.3f', $weight / 1000), '0');
+ }
+
+ /**
+ * Calculate the next weight, based on the current one.
+ *
+ * If there are less than 28 "Accept" headers, the weights will be decreased by 1 on its highest significant digit, using the
+ * following formula:
+ *
+ * next weight = current weight - 10 ^ (floor(log(current weight - 1)))
+ *
+ * ( current weight minus ( 10 raised to the power of ( floor of (log to the base 10 of ( current weight minus 1 ) ) ) ) )
+ *
+ * Starting from 1000, this generates the following series:
+ *
+ * 1000, 900, 800, 700, 600, 500, 400, 300, 200, 100, 90, 80, 70, 60, 50, 40, 30, 20, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1
+ *
+ * The resulting quality codes are closer to the average "normal" usage of them (like "q=0.9", "q=0.8" and so on), but it only works
+ * if there is a maximum of 28 "Accept" headers. If we have more than that (which is extremely unlikely), then we fall back to a 1-by-1
+ * decrement rule, which will result in quality codes like "q=0.999", "q=0.998" etc.
+ *
+ * @param int $currentWeight varying from 1 to 1000 (will be divided by 1000 to build the quality value)
+ * @param bool $hasMoreThan28Headers
+ * @return int
+ */
+ public function getNextWeight(int $currentWeight, bool $hasMoreThan28Headers): int
+ {
+ if ($currentWeight <= 1) {
+ return 1;
+ }
+
+ if ($hasMoreThan28Headers) {
+ return $currentWeight - 1;
+ }
+
+ return $currentWeight - 10 ** floor( log10($currentWeight - 1) );
+ }
+}
diff --git a/src/Http/ApiResponse.php b/src/Http/ApiResponse.php
deleted file mode 100644
index 0da47ee..0000000
--- a/src/Http/ApiResponse.php
+++ /dev/null
@@ -1,72 +0,0 @@
-statusCode = $statusCode;
- $this->headers = $headers;
- $this->result = $result;
- }
-
- /**
- * Get status code
- * @return int Status code
- */
- public function getStatusCode()
- {
- return $this->statusCode;
- }
-
- /**
- * Get headers
- * @return array Map of headers
- */
- public function getHeaders()
- {
- return $this->headers;
- }
-
- /**
- * Get API call result or body
- * @return mixed Deserialized response body
- */
- public function getResult()
- {
- return $this->result;
- }
-}
diff --git a/src/Http/HttpCallBack.php b/src/Http/HttpCallBack.php
deleted file mode 100644
index eb0cc1e..0000000
--- a/src/Http/HttpCallBack.php
+++ /dev/null
@@ -1,95 +0,0 @@
-onBeforeRequest = $onBeforeRequest;
- $this->onAfterRequest = $onAfterRequest;
- }
-
- /**
- * Set on-before event callback
- * @param callable $func On-before event callable
- */
- public function setOnBeforeRequest(callable $func)
- {
- $this->onBeforeRequest = $func;
- }
-
- /**
- * Get On-before API call event callable
- * @return callable Callable
- */
- public function getOnBeforeRequest()
- {
- return $this->onBeforeRequest;
- }
-
- /**
- * Set On-after API call event callable
- * @param callable $func On-after event callable
- */
- public function setOnAfterRequest(callable $func)
- {
- $this->onAfterRequest = $func;
- }
-
- /**
- * Get On-After API call event callable
- * @return callable On-after event callable
- */
- public function getOnAfterRequest()
- {
- return $this->onAfterRequest;
- }
-
- /**
- * Call on-before event callable
- * @param HttpRequest $httpRequest HttpRequest for this call
- */
- public function callOnBeforeRequest(HttpRequest $httpRequest)
- {
- if ($this->onBeforeRequest != null) {
- call_user_func($this->onBeforeRequest, $httpRequest);
- }
- }
-
- /**
- * Call on-after event callable
- * @param HttpContext $httpContext HttpRequest for this call
- */
- public function callOnAfterRequest(HttpContext $httpContext)
- {
- if ($this->onAfterRequest != null) {
- call_user_func($this->onAfterRequest, $httpContext);
- }
- }
-}
diff --git a/src/Http/HttpContext.php b/src/Http/HttpContext.php
deleted file mode 100644
index 48ae7e0..0000000
--- a/src/Http/HttpContext.php
+++ /dev/null
@@ -1,55 +0,0 @@
-request = $request;
- $this->response = $response;
- }
-
- /**
- * Getter for the Http Request
- * @return HttpRequest request
- */
- public function getRequest()
- {
- return $this->request;
- }
-
- /**
- * Getter for the Http Response
- * @return HttpResponse response
- */
- public function getResponse()
- {
- return $this->response;
- }
-}
diff --git a/src/Http/HttpMethod.php b/src/Http/HttpMethod.php
deleted file mode 100644
index 6293d93..0000000
--- a/src/Http/HttpMethod.php
+++ /dev/null
@@ -1,21 +0,0 @@
-httpMethod = $httpMethod;
- $this->headers = $headers;
- $this->queryUrl = $queryUrl;
- $this->parameters = $parameters;
- }
-
- /**
- * Get http method
- * @return string
- */
- public function getHttpMethod()
- {
- return $this->httpMethod;
- }
-
- /**
- * Set http method
- * @param string $httpMethod Http Method as defined in HttpMethod class
- */
- public function setHttpMethod(string $httpMethod)
- {
- $this->httpMethod = $httpMethod;
- }
-
- /**
- * Get headers
- * @return array Map of headers
- */
- public function getHeaders()
- {
- return $this->headers;
- }
-
- /**
- * Set headers
- * @param array $headers Headers as map
- */
- public function setHeaders(array $headers)
- {
- $this->headers = $headers;
- }
-
- /**
- * Get query url
- * @return string Query url
- */
- public function getQueryUrl()
- {
- return $this->queryUrl;
- }
-
- /**
- * Set query url
- * @param string $queryUrl Query url
- */
- public function setQueryUrl(string $queryUrl)
- {
- $this->queryUrl = $queryUrl;
- }
-
- /**
- * Get parameters
- * @return array Map of input parameters
- */
- public function getParameters()
- {
- return $this->parameters;
- }
-
- /**
- * Set parameters
- * @param array $parameters Map of input parameters
- */
- public function setParameters(array $parameters)
- {
- $this->parameters = $parameters;
- }
-}
diff --git a/src/Http/HttpResponse.php b/src/Http/HttpResponse.php
deleted file mode 100644
index 361bd50..0000000
--- a/src/Http/HttpResponse.php
+++ /dev/null
@@ -1,72 +0,0 @@
-statusCode = $statusCode;
- $this->headers = $headers;
- $this->rawBody = $rawBody;
- }
-
- /**
- * Get status code
- * @return int Status code
- */
- public function getStatusCode()
- {
- return $this->statusCode;
- }
-
- /**
- * Get headers
- * @return array Map of headers
- */
- public function getHeaders()
- {
- return $this->headers;
- }
-
- /**
- * Get raw response body
- * @return string Raw body
- */
- public function getRawBody()
- {
- return $this->rawBody;
- }
-}
diff --git a/src/Messaging/Controllers/APIController.php b/src/Messaging/Controllers/APIController.php
deleted file mode 100644
index d087337..0000000
--- a/src/Messaging/Controllers/APIController.php
+++ /dev/null
@@ -1,615 +0,0 @@
- $accountId,
- ));
-
- //validate and preprocess url
- $_queryUrl = APIHelper::cleanUrl($this->config->getBaseUri(Servers::MESSAGINGDEFAULT) . $_queryBuilder);
-
- //prepare headers
- $_headers = array (
- 'user-agent' => BaseController::USER_AGENT,
- 'Accept' => 'application/json',
- 'Continuation-Token' => $continuationToken
- );
-
- //set authentication
- $this->configureAuth($_headers, 'messaging');
-
- $_httpRequest = new HttpRequest(HttpMethod::GET, $_headers, $_queryUrl);
-
- //call on-before Http callback
- if ($this->getHttpCallBack() != null) {
- $this->getHttpCallBack()->callOnBeforeRequest($_httpRequest);
- }
- // Set request timeout
- Request::timeout($this->config->getTimeout());
-
- // and invoke the API call request to fetch the response
- $response = Request::get($_queryUrl, $_headers);
-
- $_httpResponse = new HttpResponse($response->code, $response->headers, $response->raw_body);
- $_httpContext = new HttpContext($_httpRequest, $_httpResponse);
-
- //call on-after Http callback
- if ($this->getHttpCallBack() != null) {
- $this->getHttpCallBack()->callOnAfterRequest($_httpContext);
- }
-
- //Error handling using HTTP status codes
- if ($response->code == 400) {
- throw new Exceptions\MessagingException('400 Request is malformed or invalid', $_httpContext);
- }
-
- if ($response->code == 401) {
- throw new Exceptions\MessagingException(
- '401 The specified user does not have access to the account',
- $_httpContext
- );
- }
-
- if ($response->code == 403) {
- throw new Exceptions\MessagingException('403 The user does not have access to this API', $_httpContext);
- }
-
- if ($response->code == 404) {
- throw new Exceptions\MessagingException('404 Path not found', $_httpContext);
- }
-
- if ($response->code == 415) {
- throw new Exceptions\MessagingException('415 The content-type of the request is incorrect', $_httpContext);
- }
-
- if ($response->code == 429) {
- throw new Exceptions\MessagingException('429 The rate limit has been reached', $_httpContext);
- }
-
- //handle errors defined at the API level
- $this->validateResponse($_httpResponse, $_httpContext);
- $mapper = $this->getJsonMapper();
- $deserializedResponse = $mapper->mapClassArray($response->body, 'BandwidthLib\\Messaging\\Models\\Media');
- return new ApiResponse($response->code, $response->headers, $deserializedResponse);
- }
-
- /**
- * Downloads a media file you previously uploaded.
- *
- * @param string $accountId User's account ID
- * @param string $mediaId Media ID to retrieve
- * @return ApiResponse response from the API call
- * @throws APIException Thrown if API call fails
- */
- public function getMedia(
- string $accountId,
- string $mediaId
- ) {
-
- //prepare query string for API call
- $_queryBuilder = '/users/{accountId}/media/{mediaId}';
-
- //process optional query parameters
- $_queryBuilder = APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array (
- 'accountId' => $accountId,
- 'mediaId' => $mediaId,
- ), false
- );
-
- //validate and preprocess url
- $_queryUrl = APIHelper::cleanUrl($this->config->getBaseUri(Servers::MESSAGINGDEFAULT) . $_queryBuilder);
-
- //prepare headers
- $_headers = array (
- 'user-agent' => BaseController::USER_AGENT
- );
-
- //set authentication
- $this->configureAuth($_headers, 'messaging');
-
- $_httpRequest = new HttpRequest(HttpMethod::GET, $_headers, $_queryUrl);
-
- //call on-before Http callback
- if ($this->getHttpCallBack() != null) {
- $this->getHttpCallBack()->callOnBeforeRequest($_httpRequest);
- }
- // Set request timeout
- Request::timeout($this->config->getTimeout());
-
- // and invoke the API call request to fetch the response
- $response = Request::get($_queryUrl, $_headers);
-
- $_httpResponse = new HttpResponse($response->code, $response->headers, $response->raw_body);
- $_httpContext = new HttpContext($_httpRequest, $_httpResponse);
-
- //call on-after Http callback
- if ($this->getHttpCallBack() != null) {
- $this->getHttpCallBack()->callOnAfterRequest($_httpContext);
- }
-
- //Error handling using HTTP status codes
- if ($response->code == 400) {
- throw new Exceptions\MessagingException('400 Request is malformed or invalid', $_httpContext);
- }
-
- if ($response->code == 401) {
- throw new Exceptions\MessagingException(
- '401 The specified user does not have access to the account',
- $_httpContext
- );
- }
-
- if ($response->code == 403) {
- throw new Exceptions\MessagingException('403 The user does not have access to this API', $_httpContext);
- }
-
- if ($response->code == 404) {
- throw new Exceptions\MessagingException('404 Path not found', $_httpContext);
- }
-
- if ($response->code == 415) {
- throw new Exceptions\MessagingException('415 The content-type of the request is incorrect', $_httpContext);
- }
-
- if ($response->code == 429) {
- throw new Exceptions\MessagingException('429 The rate limit has been reached', $_httpContext);
- }
-
- //handle errors defined at the API level
- $this->validateResponse($_httpResponse, $_httpContext);
- $deserializedResponse = $response->body;
- return new ApiResponse($response->code, $response->headers, $deserializedResponse);
- }
-
- /**
- * Uploads a file the normal HTTP way. You may add headers to the request in order to provide some
- * control to your media-file.
- *
- * @param string $accountId User's account ID
- * @param string $mediaId The user supplied custom media ID
- * @param string $body TODO: type description here
- * @param string $contentType (optional) The media type of the entity-body
- * @param string|null $cacheControl (optional) General-header field is used to specify directives that MUST be obeyed
- * by all caching mechanisms along the request/response chain.
- * @return ApiResponse response from the API call
- * @throws APIException Thrown if API call fails
- */
- public function uploadMedia(
- string $accountId,
- string $mediaId,
- string $body,
- string $contentType = 'application/octet-stream',
- ?string $cacheControl = null
- ) {
-
- //prepare query string for API call
- $_queryBuilder = '/users/{accountId}/media/{mediaId}';
-
- //process optional query parameters
- $_queryBuilder = APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array (
- 'accountId' => $accountId,
- 'mediaId' => $mediaId,
- ), false
- );
-
- //validate and preprocess url
- $_queryUrl = APIHelper::cleanUrl($this->config->getBaseUri(Servers::MESSAGINGDEFAULT) . $_queryBuilder);
-
- //prepare headers
- $_headers = array (
- 'user-agent' => BaseController::USER_AGENT,
- 'Content-Type' => (null != $contentType) ? $contentType : 'application/octet-stream',
- 'Cache-Control' => $cacheControl
- );
-
- //json encode body
- $_bodyJson = $body;
-
- //set authentication
- $this->configureAuth($_headers, 'messaging');
-
- $_httpRequest = new HttpRequest(HttpMethod::PUT, $_headers, $_queryUrl);
-
- //call on-before Http callback
- if ($this->getHttpCallBack() != null) {
- $this->getHttpCallBack()->callOnBeforeRequest($_httpRequest);
- }
- // Set request timeout
- Request::timeout($this->config->getTimeout());
-
- // and invoke the API call request to fetch the response
- $response = Request::put($_queryUrl, $_headers, $_bodyJson);
-
- $_httpResponse = new HttpResponse($response->code, $response->headers, $response->raw_body);
- $_httpContext = new HttpContext($_httpRequest, $_httpResponse);
-
- //call on-after Http callback
- if ($this->getHttpCallBack() != null) {
- $this->getHttpCallBack()->callOnAfterRequest($_httpContext);
- }
-
- //Error handling using HTTP status codes
- if ($response->code == 400) {
- throw new Exceptions\MessagingException('400 Request is malformed or invalid', $_httpContext);
- }
-
- if ($response->code == 401) {
- throw new Exceptions\MessagingException(
- '401 The specified user does not have access to the account',
- $_httpContext
- );
- }
-
- if ($response->code == 403) {
- throw new Exceptions\MessagingException('403 The user does not have access to this API', $_httpContext);
- }
-
- if ($response->code == 404) {
- throw new Exceptions\MessagingException('404 Path not found', $_httpContext);
- }
-
- if ($response->code == 415) {
- throw new Exceptions\MessagingException('415 The content-type of the request is incorrect', $_httpContext);
- }
-
- if ($response->code == 429) {
- throw new Exceptions\MessagingException('429 The rate limit has been reached', $_httpContext);
- }
-
- //handle errors defined at the API level
- $this->validateResponse($_httpResponse, $_httpContext);
- return new ApiResponse($response->code, $response->headers, null);
- }
-
- /**
- * Deletes a media file from Bandwidth API server. Make sure you don't have any application scripts
- * still using the media before you delete. If you accidentally delete a media file, you can
- * immediately upload a new file with the same name.
- *
- * @param string $accountId User's account ID
- * @param string $mediaId The media ID to delete
- * @return ApiResponse response from the API call
- * @throws APIException Thrown if API call fails
- */
- public function deleteMedia(
- string $accountId,
- string $mediaId
- ) {
-
- //prepare query string for API call
- $_queryBuilder = '/users/{accountId}/media/{mediaId}';
-
- //process optional query parameters
- $_queryBuilder = APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array (
- 'accountId' => $accountId,
- 'mediaId' => $mediaId,
- ), false
- );
-
- //validate and preprocess url
- $_queryUrl = APIHelper::cleanUrl($this->config->getBaseUri(Servers::MESSAGINGDEFAULT) . $_queryBuilder);
-
- //prepare headers
- $_headers = array (
- 'user-agent' => BaseController::USER_AGENT
- );
-
- //set authentication
- $this->configureAuth($_headers, 'messaging');
-
- $_httpRequest = new HttpRequest(HttpMethod::DELETE, $_headers, $_queryUrl);
-
- //call on-before Http callback
- if ($this->getHttpCallBack() != null) {
- $this->getHttpCallBack()->callOnBeforeRequest($_httpRequest);
- }
- // Set request timeout
- Request::timeout($this->config->getTimeout());
-
- // and invoke the API call request to fetch the response
- $response = Request::delete($_queryUrl, $_headers);
-
- $_httpResponse = new HttpResponse($response->code, $response->headers, $response->raw_body);
- $_httpContext = new HttpContext($_httpRequest, $_httpResponse);
-
- //call on-after Http callback
- if ($this->getHttpCallBack() != null) {
- $this->getHttpCallBack()->callOnAfterRequest($_httpContext);
- }
-
- //Error handling using HTTP status codes
- if ($response->code == 400) {
- throw new Exceptions\MessagingException('400 Request is malformed or invalid', $_httpContext);
- }
-
- if ($response->code == 401) {
- throw new Exceptions\MessagingException(
- '401 The specified user does not have access to the account',
- $_httpContext
- );
- }
-
- if ($response->code == 403) {
- throw new Exceptions\MessagingException('403 The user does not have access to this API', $_httpContext);
- }
-
- if ($response->code == 404) {
- throw new Exceptions\MessagingException('404 Path not found', $_httpContext);
- }
-
- if ($response->code == 415) {
- throw new Exceptions\MessagingException('415 The content-type of the request is incorrect', $_httpContext);
- }
-
- if ($response->code == 429) {
- throw new Exceptions\MessagingException('429 The rate limit has been reached', $_httpContext);
- }
-
- //handle errors defined at the API level
- $this->validateResponse($_httpResponse, $_httpContext);
- return new ApiResponse($response->code, $response->headers, null);
- }
-
- /**
- * Gets a list of messages based on query parameters.
- *
- * @param string $accountId User's account ID
- * @param string|null $messageId (optional) The ID of the message to search for. Special characters need to be
- * encoded using URL encoding
- * @param string|null $sourceTn (optional) The phone number that sent the message
- * @param string|null $destinationTn (optional) The phone number that received the message
- * @param string|null $messageStatus (optional) The status of the message. One of RECEIVED, QUEUED, SENDING, SENT,
- * FAILED, DELIVERED, ACCEPTED, UNDELIVERED
- * @param integer|null $errorCode (optional) The error code of the message
- * @param string|null $fromDateTime (optional) The start of the date range to search in ISO 8601 format. Uses the
- * message receive time. The date range to search in is currently 14 days.
- * @param string|null $toDateTime (optional) The end of the date range to search in ISO 8601 format. Uses the
- * message receive time. The date range to search in is currently 14 days.
- * @param string|null $pageToken (optional) A base64 encoded value used for pagination of results
- * @param integer|null $limit (optional) The maximum records requested in search result. Default 100. The sum of
- * limit and after cannot be more than 10000
- * @return ApiResponse response from the API call
- * @throws APIException Thrown if API call fails
- */
- public function getMessages(
- string $accountId,
- ?string $messageId = null,
- ?string $sourceTn = null,
- ?string $destinationTn = null,
- ?string $messageStatus = null,
- ?int $errorCode = null,
- ?string $fromDateTime = null,
- ?string $toDateTime = null,
- ?string $pageToken = null,
- ?int $limit = null
- ) {
-
- //prepare query string for API call
- $_queryBuilder = '/users/{accountId}/messages';
-
- //process optional query parameters
- $_queryBuilder = APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array (
- 'accountId' => $accountId,
- ));
-
- //process optional query parameters
- APIHelper::appendUrlWithQueryParameters($_queryBuilder, array (
- 'messageId' => $messageId,
- 'sourceTn' => $sourceTn,
- 'destinationTn' => $destinationTn,
- 'messageStatus' => $messageStatus,
- 'errorCode' => $errorCode,
- 'fromDateTime' => $fromDateTime,
- 'toDateTime' => $toDateTime,
- 'pageToken' => $pageToken,
- 'limit' => $limit,
- ));
-
- //validate and preprocess url
- $_queryUrl = APIHelper::cleanUrl($this->config->getBaseUri(Servers::MESSAGINGDEFAULT) . $_queryBuilder);
-
- //prepare headers
- $_headers = array (
- 'user-agent' => BaseController::USER_AGENT,
- 'Accept' => 'application/json'
- );
-
- //set authentication
- $this->configureAuth($_headers, 'messaging');
-
- $_httpRequest = new HttpRequest(HttpMethod::GET, $_headers, $_queryUrl);
-
- //call on-before Http callback
- if ($this->getHttpCallBack() != null) {
- $this->getHttpCallBack()->callOnBeforeRequest($_httpRequest);
- }
- // Set request timeout
- Request::timeout($this->config->getTimeout());
-
- // and invoke the API call request to fetch the response
- $response = Request::get($_queryUrl, $_headers);
-
- $_httpResponse = new HttpResponse($response->code, $response->headers, $response->raw_body);
- $_httpContext = new HttpContext($_httpRequest, $_httpResponse);
-
- //call on-after Http callback
- if ($this->getHttpCallBack() != null) {
- $this->getHttpCallBack()->callOnAfterRequest($_httpContext);
- }
-
- //Error handling using HTTP status codes
- if ($response->code == 400) {
- throw new Exceptions\MessagingException('400 Request is malformed or invalid', $_httpContext);
- }
-
- if ($response->code == 401) {
- throw new Exceptions\MessagingException(
- '401 The specified user does not have access to the account',
- $_httpContext
- );
- }
-
- if ($response->code == 403) {
- throw new Exceptions\MessagingException('403 The user does not have access to this API', $_httpContext);
- }
-
- if ($response->code == 404) {
- throw new Exceptions\MessagingException('404 Path not found', $_httpContext);
- }
-
- if ($response->code == 415) {
- throw new Exceptions\MessagingException('415 The content-type of the request is incorrect', $_httpContext);
- }
-
- if ($response->code == 429) {
- throw new Exceptions\MessagingException('429 The rate limit has been reached', $_httpContext);
- }
-
- //handle errors defined at the API level
- $this->validateResponse($_httpResponse, $_httpContext);
- $mapper = $this->getJsonMapper();
- $deserializedResponse = $mapper->mapClass(
- $response->body,
- 'BandwidthLib\\Messaging\\Models\\BandwidthMessagesList'
- );
- return new ApiResponse($response->code, $response->headers, $deserializedResponse);
- }
-
- /**
- * Endpoint for sending text messages and picture messages using V2 messaging.
- *
- * @param string $accountId User's account ID
- * @param Models\MessageRequest $body TODO: type description here
- * @return ApiResponse response from the API call
- * @throws APIException Thrown if API call fails
- */
- public function createMessage(
- string $accountId,
- Models\MessageRequest $body
- ) {
-
- //prepare query string for API call
- $_queryBuilder = '/users/{accountId}/messages';
-
- //process optional query parameters
- $_queryBuilder = APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array (
- 'accountId' => $accountId,
- ));
-
- //validate and preprocess url
- $_queryUrl = APIHelper::cleanUrl($this->config->getBaseUri(Servers::MESSAGINGDEFAULT) . $_queryBuilder);
-
- //prepare headers
- $_headers = array (
- 'user-agent' => BaseController::USER_AGENT,
- 'Accept' => 'application/json',
- 'content-type' => 'application/json; charset=utf-8'
- );
-
- //json encode body
- $_bodyJson = Request\Body::Json($body);
-
- //set authentication
- $this->configureAuth($_headers, 'messaging');
-
- $_httpRequest = new HttpRequest(HttpMethod::POST, $_headers, $_queryUrl);
-
- //call on-before Http callback
- if ($this->getHttpCallBack() != null) {
- $this->getHttpCallBack()->callOnBeforeRequest($_httpRequest);
- }
- // Set request timeout
- Request::timeout($this->config->getTimeout());
-
- // and invoke the API call request to fetch the response
- $response = Request::post($_queryUrl, $_headers, $_bodyJson);
-
- $_httpResponse = new HttpResponse($response->code, $response->headers, $response->raw_body);
- $_httpContext = new HttpContext($_httpRequest, $_httpResponse);
-
- //call on-after Http callback
- if ($this->getHttpCallBack() != null) {
- $this->getHttpCallBack()->callOnAfterRequest($_httpContext);
- }
-
- //Error handling using HTTP status codes
- if ($response->code == 400) {
- throw new Exceptions\MessagingException('400 Request is malformed or invalid', $_httpContext);
- }
-
- if ($response->code == 401) {
- throw new Exceptions\MessagingException(
- '401 The specified user does not have access to the account',
- $_httpContext
- );
- }
-
- if ($response->code == 403) {
- throw new Exceptions\MessagingException('403 The user does not have access to this API', $_httpContext);
- }
-
- if ($response->code == 404) {
- throw new Exceptions\MessagingException('404 Path not found', $_httpContext);
- }
-
- if ($response->code == 415) {
- throw new Exceptions\MessagingException('415 The content-type of the request is incorrect', $_httpContext);
- }
-
- if ($response->code == 429) {
- throw new Exceptions\MessagingException('429 The rate limit has been reached', $_httpContext);
- }
-
- //handle errors defined at the API level
- $this->validateResponse($_httpResponse, $_httpContext);
- $mapper = $this->getJsonMapper();
- $deserializedResponse = $mapper->mapClass($response->body, 'BandwidthLib\\Messaging\\Models\\BandwidthMessage');
- return new ApiResponse($response->code, $response->headers, $deserializedResponse);
- }
-}
diff --git a/src/Messaging/Exceptions/MessagingException.php b/src/Messaging/Exceptions/MessagingException.php
deleted file mode 100644
index 238368f..0000000
--- a/src/Messaging/Exceptions/MessagingException.php
+++ /dev/null
@@ -1,46 +0,0 @@
-config = $config;
- }
-
-
- private $client;
-
- /**
- * Provides access to API controller
- * @return Controllers\APIController
- */
- public function getClient()
- {
- if ($this->client == null) {
- $this->client = new Controllers\APIController($this->config);
- }
- return $this->client;
- }
-}
diff --git a/src/Messaging/Models/BandwidthCallbackMessage.php b/src/Messaging/Models/BandwidthCallbackMessage.php
deleted file mode 100644
index ca22d91..0000000
--- a/src/Messaging/Models/BandwidthCallbackMessage.php
+++ /dev/null
@@ -1,81 +0,0 @@
-time = func_get_arg(0);
- $this->type = func_get_arg(1);
- $this->to = func_get_arg(2);
- $this->errorCode = func_get_arg(3);
- $this->description = func_get_arg(4);
- $this->message = func_get_arg(5);
- }
- }
-
- /**
- * Encode this object to JSON
- */
- public function jsonSerialize(): array
- {
- $json = array();
- $json['time'] = $this->time;
- $json['type'] = $this->type;
- $json['to'] = $this->to;
- $json['errorCode'] = $this->errorCode;
- $json['description'] = $this->description;
- $json['message'] = $this->message;
-
- return array_filter($json);
- }
-}
diff --git a/src/Messaging/Models/BandwidthMessage.php b/src/Messaging/Models/BandwidthMessage.php
deleted file mode 100644
index 2e0bc0c..0000000
--- a/src/Messaging/Models/BandwidthMessage.php
+++ /dev/null
@@ -1,134 +0,0 @@
-id = func_get_arg(0);
- $this->owner = func_get_arg(1);
- $this->applicationId = func_get_arg(2);
- $this->time = func_get_arg(3);
- $this->segmentCount = func_get_arg(4);
- $this->direction = func_get_arg(5);
- $this->to = func_get_arg(6);
- $this->from = func_get_arg(7);
- $this->media = func_get_arg(8);
- $this->text = func_get_arg(9);
- $this->tag = func_get_arg(10);
- $this->priority = func_get_arg(11);
- }
- }
-
- /**
- * Encode this object to JSON
- */
- public function jsonSerialize(): array
- {
- $json = array();
- $json['id'] = $this->id;
- $json['owner'] = $this->owner;
- $json['applicationId'] = $this->applicationId;
- $json['time'] = $this->time;
- $json['segmentCount'] = $this->segmentCount;
- $json['direction'] = $this->direction;
- $json['to'] = isset($this->to) ?
- array_values($this->to) : null;
- $json['from'] = $this->from;
- $json['media'] = isset($this->media) ?
- array_values($this->media) : null;
- $json['text'] = $this->text;
- $json['tag'] = $this->tag;
- $json['priority'] = $this->priority;
-
- return array_filter($json);
- }
-}
diff --git a/src/Messaging/Models/BandwidthMessageItem.php b/src/Messaging/Models/BandwidthMessageItem.php
deleted file mode 100644
index 2165544..0000000
--- a/src/Messaging/Models/BandwidthMessageItem.php
+++ /dev/null
@@ -1,161 +0,0 @@
-messageId = func_get_arg(0);
- $this->accountId = func_get_arg(1);
- $this->sourceTn = func_get_arg(2);
- $this->destinationTn = func_get_arg(3);
- $this->messageStatus = func_get_arg(4);
- $this->messageDirection = func_get_arg(5);
- $this->messageType = func_get_arg(6);
- $this->segmentCount = func_get_arg(7);
- $this->errorCode = func_get_arg(8);
- $this->receiveTime = func_get_arg(9);
- $this->carrierName = func_get_arg(10);
- $this->messageSize = func_get_arg(11);
- $this->messageLength = func_get_arg(12);
- $this->attachmentCount = func_get_arg(13);
- $this->recipientCount = func_get_arg(14);
- $this->campaignClass = func_get_arg(15);
- }
- }
-
- /**
- * Encode this object to JSON
- */
- public function jsonSerialize(): array
- {
- $json = array();
- $json['messageId'] = $this->messageId;
- $json['accountId'] = $this->accountId;
- $json['sourceTn'] = $this->sourceTn;
- $json['destinationTn'] = $this->destinationTn;
- $json['messageStatus'] = $this->messageStatus;
- $json['messageDirection'] = $this->messageDirection;
- $json['messageType'] = $this->messageType;
- $json['segmentCount'] = $this->segmentCount;
- $json['errorCode'] = $this->errorCode;
- $json['receiveTime'] = $this->receiveTime;
- $json['carrierName'] = $this->carrierName;
- $json['messageSize'] = $this->messageSize;
- $json['messageLength'] = $this->messageLength;
- $json['attachmentCount'] = $this->attachmentCount;
- $json['recipientCount'] = $this->recipientCount;
- $json['campaignClass'] = $this->campaignClass;
-
- return array_filter($json);
- }
-}
diff --git a/src/Messaging/Models/BandwidthMessagesList.php b/src/Messaging/Models/BandwidthMessagesList.php
deleted file mode 100644
index 8b4dc44..0000000
--- a/src/Messaging/Models/BandwidthMessagesList.php
+++ /dev/null
@@ -1,58 +0,0 @@
-totalCount = func_get_arg(0);
- $this->pageInfo = func_get_arg(1);
- $this->messages = func_get_arg(2);
- }
- }
-
- /**
- * Encode this object to JSON
- */
- public function jsonSerialize(): array
- {
- $json = array();
- $json['totalCount'] = $this->totalCount;
- $json['pageInfo'] = $this->pageInfo;
- $json['messages'] = isset($this->messages) ?
- array_values($this->messages) : null;
-
- return array_filter($json);
- }
-}
diff --git a/src/Messaging/Models/DeferredResult.php b/src/Messaging/Models/DeferredResult.php
deleted file mode 100644
index 70c71d7..0000000
--- a/src/Messaging/Models/DeferredResult.php
+++ /dev/null
@@ -1,49 +0,0 @@
-result = func_get_arg(0);
- $this->setOrExpired = func_get_arg(1);
- }
- }
-
- /**
- * Encode this object to JSON
- */
- public function jsonSerialize(): array
- {
- $json = array();
- $json['result'] = $this->result;
- $json['setOrExpired'] = $this->setOrExpired;
-
- return array_filter($json);
- }
-}
diff --git a/src/Messaging/Models/Media.php b/src/Messaging/Models/Media.php
deleted file mode 100644
index 942cd45..0000000
--- a/src/Messaging/Models/Media.php
+++ /dev/null
@@ -1,57 +0,0 @@
-content = func_get_arg(0);
- $this->contentLength = func_get_arg(1);
- $this->mediaName = func_get_arg(2);
- }
- }
-
- /**
- * Encode this object to JSON
- */
- public function jsonSerialize(): array
- {
- $json = array();
- $json['content'] = $this->content;
- $json['contentLength'] = $this->contentLength;
- $json['mediaName'] = $this->mediaName;
-
- return array_filter($json);
- }
-}
diff --git a/src/Messaging/Models/MessageRequest.php b/src/Messaging/Models/MessageRequest.php
deleted file mode 100644
index 08ddbc9..0000000
--- a/src/Messaging/Models/MessageRequest.php
+++ /dev/null
@@ -1,95 +0,0 @@
-applicationId = func_get_arg(0);
- $this->to = func_get_arg(1);
- $this->from = func_get_arg(2);
- $this->text = func_get_arg(3);
- $this->media = func_get_arg(4);
- $this->tag = func_get_arg(5);
- $this->priority = func_get_arg(6);
- }
- }
-
- /**
- * Encode this object to JSON
- */
- public function jsonSerialize(): array
- {
- $json = array();
- $json['applicationId'] = $this->applicationId;
- $json['to'] = array_values($this->to);
- $json['from'] = $this->from;
- $json['text'] = $this->text;
- $json['media'] = isset($this->media) ?
- array_values($this->media) : null;
- $json['tag'] = $this->tag;
- $json['priority'] = $this->priority;
-
- return array_filter($json);
- }
-}
diff --git a/src/Messaging/Models/PageInfo.php b/src/Messaging/Models/PageInfo.php
deleted file mode 100644
index 2250bf7..0000000
--- a/src/Messaging/Models/PageInfo.php
+++ /dev/null
@@ -1,65 +0,0 @@
-prevPage = func_get_arg(0);
- $this->nextPage = func_get_arg(1);
- $this->prevPageToken = func_get_arg(2);
- $this->nextPageToken = func_get_arg(3);
- }
- }
-
- /**
- * Encode this object to JSON
- */
- public function jsonSerialize(): array
- {
- $json = array();
- $json['prevPage'] = $this->prevPage;
- $json['nextPage'] = $this->nextPage;
- $json['prevPageToken'] = $this->prevPageToken;
- $json['nextPageToken'] = $this->nextPageToken;
-
- return array_filter($json);
- }
-}
diff --git a/src/Messaging/Models/PriorityEnum.php b/src/Messaging/Models/PriorityEnum.php
deleted file mode 100644
index 7215ad9..0000000
--- a/src/Messaging/Models/PriorityEnum.php
+++ /dev/null
@@ -1,25 +0,0 @@
-key = func_get_arg(0);
- $this->value = func_get_arg(1);
- }
- }
-
- /**
- * Encode this object to JSON
- */
- public function jsonSerialize(): array
- {
- $json = array();
- $json['key'] = $this->key;
- $json['value'] = $this->value;
-
- return array_filter($json);
- }
-}
diff --git a/src/Model/AccountStatistics.php b/src/Model/AccountStatistics.php
new file mode 100644
index 0000000..a4a65fa
--- /dev/null
+++ b/src/Model/AccountStatistics.php
@@ -0,0 +1,418 @@
+
+ */
+class AccountStatistics implements ModelInterface, ArrayAccess, JsonSerializable
+{
+ public const DISCRIMINATOR = null;
+
+ /**
+ * The original name of the model.
+ *
+ * @var string
+ */
+ protected static string $openAPIModelName = 'accountStatistics';
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @var array
+ */
+ protected static array $openAPITypes = [
+ 'current_call_queue_size' => 'int',
+ 'max_call_queue_size' => 'int'
+ ];
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @var array
+ */
+ protected static array $openAPIFormats = [
+ 'current_call_queue_size' => null,
+ 'max_call_queue_size' => null
+ ];
+
+ /**
+ * Array of nullable properties. Used for (de)serialization
+ *
+ * @var array
+ */
+ protected static array $openAPINullables = [
+ 'current_call_queue_size' => false,
+ 'max_call_queue_size' => false
+ ];
+
+ /**
+ * 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 = [
+ 'current_call_queue_size' => 'currentCallQueueSize',
+ 'max_call_queue_size' => 'maxCallQueueSize'
+ ];
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @var array
+ */
+ protected static array $setters = [
+ 'current_call_queue_size' => 'setCurrentCallQueueSize',
+ 'max_call_queue_size' => 'setMaxCallQueueSize'
+ ];
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @var array
+ */
+ protected static array $getters = [
+ 'current_call_queue_size' => 'getCurrentCallQueueSize',
+ 'max_call_queue_size' => 'getMaxCallQueueSize'
+ ];
+
+ /**
+ * {@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('current_call_queue_size', $data ?? [], null);
+ $this->setIfExists('max_call_queue_size', $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 = [];
+
+ return $invalidProperties;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function valid(): bool
+ {
+ return count($this->listInvalidProperties()) === 0;
+ }
+
+
+ /**
+ * Gets current_call_queue_size
+ *
+ * @return int|null
+ */
+ public function getCurrentCallQueueSize(): ?int
+ {
+ return $this->container['current_call_queue_size'];
+ }
+
+ /**
+ * Sets current_call_queue_size
+ *
+ * @param int|null $current_call_queue_size The number of calls currently enqueued.
+ *
+ * @return $this
+ */
+ public function setCurrentCallQueueSize(?int $current_call_queue_size): static
+ {
+ if (is_null($current_call_queue_size)) {
+ throw new InvalidArgumentException('non-nullable current_call_queue_size cannot be null');
+ }
+ $this->container['current_call_queue_size'] = $current_call_queue_size;
+
+ return $this;
+ }
+
+ /**
+ * Gets max_call_queue_size
+ *
+ * @return int|null
+ */
+ public function getMaxCallQueueSize(): ?int
+ {
+ return $this->container['max_call_queue_size'];
+ }
+
+ /**
+ * Sets max_call_queue_size
+ *
+ * @param int|null $max_call_queue_size The maximum size of the queue before outgoing calls start being rejected.
+ *
+ * @return $this
+ */
+ public function setMaxCallQueueSize(?int $max_call_queue_size): static
+ {
+ if (is_null($max_call_queue_size)) {
+ throw new InvalidArgumentException('non-nullable max_call_queue_size cannot be null');
+ }
+ $this->container['max_call_queue_size'] = $max_call_queue_size;
+
+ 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/AdditionalDenialReason.php b/src/Model/AdditionalDenialReason.php
new file mode 100644
index 0000000..9da7a3b
--- /dev/null
+++ b/src/Model/AdditionalDenialReason.php
@@ -0,0 +1,461 @@
+
+ */
+class AdditionalDenialReason implements ModelInterface, ArrayAccess, JsonSerializable
+{
+ public const DISCRIMINATOR = null;
+
+ /**
+ * The original name of the model.
+ *
+ * @var string
+ */
+ protected static string $openAPIModelName = 'additionalDenialReason';
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @var array
+ */
+ protected static array $openAPITypes = [
+ 'status_code' => 'int',
+ 'reason' => 'string',
+ 'resubmit_allowed' => 'bool'
+ ];
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @var array
+ */
+ protected static array $openAPIFormats = [
+ 'status_code' => null,
+ 'reason' => null,
+ 'resubmit_allowed' => null
+ ];
+
+ /**
+ * Array of nullable properties. Used for (de)serialization
+ *
+ * @var array
+ */
+ protected static array $openAPINullables = [
+ 'status_code' => false,
+ 'reason' => false,
+ 'resubmit_allowed' => false
+ ];
+
+ /**
+ * 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 = [
+ 'status_code' => 'statusCode',
+ 'reason' => 'reason',
+ 'resubmit_allowed' => 'resubmitAllowed'
+ ];
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @var array
+ */
+ protected static array $setters = [
+ 'status_code' => 'setStatusCode',
+ 'reason' => 'setReason',
+ 'resubmit_allowed' => 'setResubmitAllowed'
+ ];
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @var array
+ */
+ protected static array $getters = [
+ 'status_code' => 'getStatusCode',
+ 'reason' => 'getReason',
+ 'resubmit_allowed' => 'getResubmitAllowed'
+ ];
+
+ /**
+ * {@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('status_code', $data ?? [], null);
+ $this->setIfExists('reason', $data ?? [], null);
+ $this->setIfExists('resubmit_allowed', $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['status_code'] === null) {
+ $invalidProperties[] = "'status_code' can't be null";
+ }
+ if ($this->container['reason'] === null) {
+ $invalidProperties[] = "'reason' can't be null";
+ }
+ if ($this->container['resubmit_allowed'] === null) {
+ $invalidProperties[] = "'resubmit_allowed' can't be null";
+ }
+ return $invalidProperties;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function valid(): bool
+ {
+ return count($this->listInvalidProperties()) === 0;
+ }
+
+
+ /**
+ * Gets status_code
+ *
+ * @return int
+ */
+ public function getStatusCode(): int
+ {
+ return $this->container['status_code'];
+ }
+
+ /**
+ * Sets status_code
+ *
+ * @param int $status_code Reason code for denial.
+ *
+ * @return $this
+ */
+ public function setStatusCode(int $status_code): static
+ {
+ if (is_null($status_code)) {
+ throw new InvalidArgumentException('non-nullable status_code cannot be null');
+ }
+ $this->container['status_code'] = $status_code;
+
+ return $this;
+ }
+
+ /**
+ * Gets reason
+ *
+ * @return string
+ */
+ public function getReason(): string
+ {
+ return $this->container['reason'];
+ }
+
+ /**
+ * Sets reason
+ *
+ * @param string $reason Explanation for why a verification request was declined.
+ *
+ * @return $this
+ */
+ public function setReason(string $reason): static
+ {
+ if (is_null($reason)) {
+ throw new InvalidArgumentException('non-nullable reason cannot be null');
+ }
+ $this->container['reason'] = $reason;
+
+ return $this;
+ }
+
+ /**
+ * Gets resubmit_allowed
+ *
+ * @return bool
+ */
+ public function getResubmitAllowed(): bool
+ {
+ return $this->container['resubmit_allowed'];
+ }
+
+ /**
+ * Sets resubmit_allowed
+ *
+ * @param bool $resubmit_allowed Whether a Toll-Free Verification request qualifies for resubmission via PUT.
+ *
+ * @return $this
+ */
+ public function setResubmitAllowed(bool $resubmit_allowed): static
+ {
+ if (is_null($resubmit_allowed)) {
+ throw new InvalidArgumentException('non-nullable resubmit_allowed cannot be null');
+ }
+ $this->container['resubmit_allowed'] = $resubmit_allowed;
+
+ 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/Address.php b/src/Model/Address.php
new file mode 100644
index 0000000..db6710a
--- /dev/null
+++ b/src/Model/Address.php
@@ -0,0 +1,712 @@
+
+ */
+class Address implements ModelInterface, ArrayAccess, JsonSerializable
+{
+ public const DISCRIMINATOR = null;
+
+ /**
+ * The original name of the model.
+ *
+ * @var string
+ */
+ protected static string $openAPIModelName = 'address';
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @var array
+ */
+ protected static array $openAPITypes = [
+ 'name' => 'string',
+ 'addr1' => 'string',
+ 'addr2' => 'string',
+ 'city' => 'string',
+ 'state' => 'string',
+ 'zip' => 'string',
+ 'url' => 'string'
+ ];
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @var array
+ */
+ protected static array $openAPIFormats = [
+ 'name' => null,
+ 'addr1' => null,
+ 'addr2' => null,
+ 'city' => null,
+ 'state' => null,
+ 'zip' => null,
+ 'url' => 'url'
+ ];
+
+ /**
+ * Array of nullable properties. Used for (de)serialization
+ *
+ * @var array
+ */
+ protected static array $openAPINullables = [
+ 'name' => false,
+ 'addr1' => false,
+ 'addr2' => true,
+ 'city' => false,
+ 'state' => false,
+ 'zip' => false,
+ 'url' => false
+ ];
+
+ /**
+ * 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 = [
+ 'name' => 'name',
+ 'addr1' => 'addr1',
+ 'addr2' => 'addr2',
+ 'city' => 'city',
+ 'state' => 'state',
+ 'zip' => 'zip',
+ 'url' => 'url'
+ ];
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @var array
+ */
+ protected static array $setters = [
+ 'name' => 'setName',
+ 'addr1' => 'setAddr1',
+ 'addr2' => 'setAddr2',
+ 'city' => 'setCity',
+ 'state' => 'setState',
+ 'zip' => 'setZip',
+ 'url' => 'setUrl'
+ ];
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @var array
+ */
+ protected static array $getters = [
+ 'name' => 'getName',
+ 'addr1' => 'getAddr1',
+ 'addr2' => 'getAddr2',
+ 'city' => 'getCity',
+ 'state' => 'getState',
+ 'zip' => 'getZip',
+ 'url' => 'getUrl'
+ ];
+
+ /**
+ * {@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('name', $data ?? [], null);
+ $this->setIfExists('addr1', $data ?? [], null);
+ $this->setIfExists('addr2', $data ?? [], null);
+ $this->setIfExists('city', $data ?? [], null);
+ $this->setIfExists('state', $data ?? [], null);
+ $this->setIfExists('zip', $data ?? [], null);
+ $this->setIfExists('url', $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['name'] === null) {
+ $invalidProperties[] = "'name' can't be null";
+ }
+ if ((mb_strlen($this->container['name']) > 500)) {
+ $invalidProperties[] = "invalid value for 'name', the character length must be smaller than or equal to 500.";
+ }
+
+ if ((mb_strlen($this->container['name']) < 1)) {
+ $invalidProperties[] = "invalid value for 'name', the character length must be bigger than or equal to 1.";
+ }
+
+ if ($this->container['addr1'] === null) {
+ $invalidProperties[] = "'addr1' can't be null";
+ }
+ if ((mb_strlen($this->container['addr1']) > 500)) {
+ $invalidProperties[] = "invalid value for 'addr1', the character length must be smaller than or equal to 500.";
+ }
+
+ if ((mb_strlen($this->container['addr1']) < 1)) {
+ $invalidProperties[] = "invalid value for 'addr1', the character length must be bigger than or equal to 1.";
+ }
+
+ if (!is_null($this->container['addr2']) && (mb_strlen($this->container['addr2']) > 500)) {
+ $invalidProperties[] = "invalid value for 'addr2', the character length must be smaller than or equal to 500.";
+ }
+
+ if (!is_null($this->container['addr2']) && (mb_strlen($this->container['addr2']) < 0)) {
+ $invalidProperties[] = "invalid value for 'addr2', the character length must be bigger than or equal to 0.";
+ }
+
+ if ($this->container['city'] === null) {
+ $invalidProperties[] = "'city' can't be null";
+ }
+ if ((mb_strlen($this->container['city']) > 500)) {
+ $invalidProperties[] = "invalid value for 'city', the character length must be smaller than or equal to 500.";
+ }
+
+ if ((mb_strlen($this->container['city']) < 1)) {
+ $invalidProperties[] = "invalid value for 'city', the character length must be bigger than or equal to 1.";
+ }
+
+ if ($this->container['state'] === null) {
+ $invalidProperties[] = "'state' can't be null";
+ }
+ if ((mb_strlen($this->container['state']) > 500)) {
+ $invalidProperties[] = "invalid value for 'state', the character length must be smaller than or equal to 500.";
+ }
+
+ if ((mb_strlen($this->container['state']) < 1)) {
+ $invalidProperties[] = "invalid value for 'state', the character length must be bigger than or equal to 1.";
+ }
+
+ if ($this->container['zip'] === null) {
+ $invalidProperties[] = "'zip' can't be null";
+ }
+ if (!preg_match("/[- A-Za-z0-9]{0,500}/", $this->container['zip'])) {
+ $invalidProperties[] = "invalid value for 'zip', must be conform to the pattern /[- A-Za-z0-9]{0,500}/.";
+ }
+
+ if ($this->container['url'] === null) {
+ $invalidProperties[] = "'url' can't be null";
+ }
+ if ((mb_strlen($this->container['url']) > 500)) {
+ $invalidProperties[] = "invalid value for 'url', the character length must be smaller than or equal to 500.";
+ }
+
+ if ((mb_strlen($this->container['url']) < 1)) {
+ $invalidProperties[] = "invalid value for 'url', the character length must be bigger than or equal to 1.";
+ }
+
+ return $invalidProperties;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function valid(): bool
+ {
+ return count($this->listInvalidProperties()) === 0;
+ }
+
+
+ /**
+ * Gets name
+ *
+ * @return string
+ */
+ public function getName(): string
+ {
+ return $this->container['name'];
+ }
+
+ /**
+ * Sets name
+ *
+ * @param string $name The name of the business using the toll-free number.
+ *
+ * @return $this
+ */
+ public function setName(string $name): static
+ {
+ if (is_null($name)) {
+ throw new InvalidArgumentException('non-nullable name cannot be null');
+ }
+ if ((mb_strlen($name) > 500)) {
+ throw new InvalidArgumentException('invalid length for $name when calling Address., must be smaller than or equal to 500.');
+ }
+ if ((mb_strlen($name) < 1)) {
+ throw new InvalidArgumentException('invalid length for $name when calling Address., must be bigger than or equal to 1.');
+ }
+
+ $this->container['name'] = $name;
+
+ return $this;
+ }
+
+ /**
+ * Gets addr1
+ *
+ * @return string
+ */
+ public function getAddr1(): string
+ {
+ return $this->container['addr1'];
+ }
+
+ /**
+ * Sets addr1
+ *
+ * @param string $addr1 The address of the business using the toll-free number.
+ *
+ * @return $this
+ */
+ public function setAddr1(string $addr1): static
+ {
+ if (is_null($addr1)) {
+ throw new InvalidArgumentException('non-nullable addr1 cannot be null');
+ }
+ if ((mb_strlen($addr1) > 500)) {
+ throw new InvalidArgumentException('invalid length for $addr1 when calling Address., must be smaller than or equal to 500.');
+ }
+ if ((mb_strlen($addr1) < 1)) {
+ throw new InvalidArgumentException('invalid length for $addr1 when calling Address., must be bigger than or equal to 1.');
+ }
+
+ $this->container['addr1'] = $addr1;
+
+ return $this;
+ }
+
+ /**
+ * Gets addr2
+ *
+ * @return string|null
+ */
+ public function getAddr2(): ?string
+ {
+ return $this->container['addr2'];
+ }
+
+ /**
+ * Sets addr2
+ *
+ * @param string|null $addr2 The address of the business using the toll-free number.
+ *
+ * @return $this
+ */
+ public function setAddr2(?string $addr2): static
+ {
+ if (is_null($addr2)) {
+ array_push($this->openAPINullablesSetToNull, 'addr2');
+ } else {
+ $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+ $index = array_search('addr2', $nullablesSetToNull);
+ if ($index !== FALSE) {
+ unset($nullablesSetToNull[$index]);
+ $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+ }
+ }
+ if (!is_null($addr2) && (mb_strlen($addr2) > 500)) {
+ throw new InvalidArgumentException('invalid length for $addr2 when calling Address., must be smaller than or equal to 500.');
+ }
+ if (!is_null($addr2) && (mb_strlen($addr2) < 0)) {
+ throw new InvalidArgumentException('invalid length for $addr2 when calling Address., must be bigger than or equal to 0.');
+ }
+
+ $this->container['addr2'] = $addr2;
+
+ return $this;
+ }
+
+ /**
+ * Gets city
+ *
+ * @return string
+ */
+ public function getCity(): string
+ {
+ return $this->container['city'];
+ }
+
+ /**
+ * Sets city
+ *
+ * @param string $city The city of the business using the toll-free number.
+ *
+ * @return $this
+ */
+ public function setCity(string $city): static
+ {
+ if (is_null($city)) {
+ throw new InvalidArgumentException('non-nullable city cannot be null');
+ }
+ if ((mb_strlen($city) > 500)) {
+ throw new InvalidArgumentException('invalid length for $city when calling Address., must be smaller than or equal to 500.');
+ }
+ if ((mb_strlen($city) < 1)) {
+ throw new InvalidArgumentException('invalid length for $city when calling Address., must be bigger than or equal to 1.');
+ }
+
+ $this->container['city'] = $city;
+
+ return $this;
+ }
+
+ /**
+ * Gets state
+ *
+ * @return string
+ */
+ public function getState(): string
+ {
+ return $this->container['state'];
+ }
+
+ /**
+ * Sets state
+ *
+ * @param string $state The state of the business using the toll-free number.
+ *
+ * @return $this
+ */
+ public function setState(string $state): static
+ {
+ if (is_null($state)) {
+ throw new InvalidArgumentException('non-nullable state cannot be null');
+ }
+ if ((mb_strlen($state) > 500)) {
+ throw new InvalidArgumentException('invalid length for $state when calling Address., must be smaller than or equal to 500.');
+ }
+ if ((mb_strlen($state) < 1)) {
+ throw new InvalidArgumentException('invalid length for $state when calling Address., must be bigger than or equal to 1.');
+ }
+
+ $this->container['state'] = $state;
+
+ return $this;
+ }
+
+ /**
+ * Gets zip
+ *
+ * @return string
+ */
+ public function getZip(): string
+ {
+ return $this->container['zip'];
+ }
+
+ /**
+ * Sets zip
+ *
+ * @param string $zip The zip of the business using the toll-free number.
+ *
+ * @return $this
+ */
+ public function setZip(string $zip): static
+ {
+ if (is_null($zip)) {
+ throw new InvalidArgumentException('non-nullable zip cannot be null');
+ }
+
+ if ((!preg_match("/[- A-Za-z0-9]{0,500}/", ObjectSerializer::toString($zip)))) {
+ throw new InvalidArgumentException("invalid value for \$zip when calling Address., must conform to the pattern /[- A-Za-z0-9]{0,500}/.");
+ }
+
+ $this->container['zip'] = $zip;
+
+ return $this;
+ }
+
+ /**
+ * Gets url
+ *
+ * @return string
+ */
+ public function getUrl(): string
+ {
+ return $this->container['url'];
+ }
+
+ /**
+ * Sets url
+ *
+ * @param string $url The website of the business using the toll-free number.
+ *
+ * @return $this
+ */
+ public function setUrl(string $url): static
+ {
+ if (is_null($url)) {
+ throw new InvalidArgumentException('non-nullable url cannot be null');
+ }
+ if ((mb_strlen($url) > 500)) {
+ throw new InvalidArgumentException('invalid length for $url when calling Address., must be smaller than or equal to 500.');
+ }
+ if ((mb_strlen($url) < 1)) {
+ throw new InvalidArgumentException('invalid length for $url when calling Address., must be bigger than or equal to 1.');
+ }
+
+ $this->container['url'] = $url;
+
+ 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/AnswerCallback.php b/src/Model/AnswerCallback.php
new file mode 100644
index 0000000..838124e
--- /dev/null
+++ b/src/Model/AnswerCallback.php
@@ -0,0 +1,855 @@
+
+ */
+class AnswerCallback implements ModelInterface, ArrayAccess, JsonSerializable
+{
+ public const DISCRIMINATOR = null;
+
+ /**
+ * The original name of the model.
+ *
+ * @var string
+ */
+ protected static string $openAPIModelName = 'answerCallback';
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @var array
+ */
+ protected static array $openAPITypes = [
+ 'event_type' => 'string',
+ 'event_time' => '\DateTime',
+ 'account_id' => 'string',
+ 'application_id' => 'string',
+ 'from' => 'string',
+ 'to' => 'string',
+ 'direction' => '\Bandwidth\Model\CallDirectionEnum',
+ 'call_id' => 'string',
+ 'call_url' => 'string',
+ 'enqueued_time' => '\DateTime',
+ 'start_time' => '\DateTime',
+ 'answer_time' => '\DateTime',
+ 'tag' => 'string',
+ 'machine_detection_result' => '\Bandwidth\Model\MachineDetectionResult'
+ ];
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @var array
+ */
+ protected static array $openAPIFormats = [
+ 'event_type' => null,
+ 'event_time' => 'date-time',
+ 'account_id' => null,
+ 'application_id' => null,
+ 'from' => null,
+ 'to' => null,
+ 'direction' => null,
+ 'call_id' => null,
+ 'call_url' => 'uri',
+ 'enqueued_time' => 'date-time',
+ 'start_time' => 'date-time',
+ 'answer_time' => 'date-time',
+ 'tag' => null,
+ 'machine_detection_result' => null
+ ];
+
+ /**
+ * Array of nullable properties. Used for (de)serialization
+ *
+ * @var array
+ */
+ protected static array $openAPINullables = [
+ 'event_type' => false,
+ 'event_time' => false,
+ 'account_id' => false,
+ 'application_id' => false,
+ 'from' => false,
+ 'to' => false,
+ 'direction' => false,
+ 'call_id' => false,
+ 'call_url' => false,
+ 'enqueued_time' => true,
+ 'start_time' => false,
+ 'answer_time' => true,
+ 'tag' => true,
+ 'machine_detection_result' => 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 = [
+ 'event_type' => 'eventType',
+ 'event_time' => 'eventTime',
+ 'account_id' => 'accountId',
+ 'application_id' => 'applicationId',
+ 'from' => 'from',
+ 'to' => 'to',
+ 'direction' => 'direction',
+ 'call_id' => 'callId',
+ 'call_url' => 'callUrl',
+ 'enqueued_time' => 'enqueuedTime',
+ 'start_time' => 'startTime',
+ 'answer_time' => 'answerTime',
+ 'tag' => 'tag',
+ 'machine_detection_result' => 'machineDetectionResult'
+ ];
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @var array
+ */
+ protected static array $setters = [
+ 'event_type' => 'setEventType',
+ 'event_time' => 'setEventTime',
+ 'account_id' => 'setAccountId',
+ 'application_id' => 'setApplicationId',
+ 'from' => 'setFrom',
+ 'to' => 'setTo',
+ 'direction' => 'setDirection',
+ 'call_id' => 'setCallId',
+ 'call_url' => 'setCallUrl',
+ 'enqueued_time' => 'setEnqueuedTime',
+ 'start_time' => 'setStartTime',
+ 'answer_time' => 'setAnswerTime',
+ 'tag' => 'setTag',
+ 'machine_detection_result' => 'setMachineDetectionResult'
+ ];
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @var array
+ */
+ protected static array $getters = [
+ 'event_type' => 'getEventType',
+ 'event_time' => 'getEventTime',
+ 'account_id' => 'getAccountId',
+ 'application_id' => 'getApplicationId',
+ 'from' => 'getFrom',
+ 'to' => 'getTo',
+ 'direction' => 'getDirection',
+ 'call_id' => 'getCallId',
+ 'call_url' => 'getCallUrl',
+ 'enqueued_time' => 'getEnqueuedTime',
+ 'start_time' => 'getStartTime',
+ 'answer_time' => 'getAnswerTime',
+ 'tag' => 'getTag',
+ 'machine_detection_result' => 'getMachineDetectionResult'
+ ];
+
+ /**
+ * {@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('event_type', $data ?? [], null);
+ $this->setIfExists('event_time', $data ?? [], null);
+ $this->setIfExists('account_id', $data ?? [], null);
+ $this->setIfExists('application_id', $data ?? [], null);
+ $this->setIfExists('from', $data ?? [], null);
+ $this->setIfExists('to', $data ?? [], null);
+ $this->setIfExists('direction', $data ?? [], null);
+ $this->setIfExists('call_id', $data ?? [], null);
+ $this->setIfExists('call_url', $data ?? [], null);
+ $this->setIfExists('enqueued_time', $data ?? [], null);
+ $this->setIfExists('start_time', $data ?? [], null);
+ $this->setIfExists('answer_time', $data ?? [], null);
+ $this->setIfExists('tag', $data ?? [], null);
+ $this->setIfExists('machine_detection_result', $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 = [];
+
+ return $invalidProperties;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function valid(): bool
+ {
+ return count($this->listInvalidProperties()) === 0;
+ }
+
+
+ /**
+ * Gets event_type
+ *
+ * @return string|null
+ */
+ public function getEventType(): ?string
+ {
+ return $this->container['event_type'];
+ }
+
+ /**
+ * Sets event_type
+ *
+ * @param string|null $event_type The event type, value can be one of the following: answer, bridgeComplete, bridgeTargetComplete, conferenceCreated, conferenceRedirect, conferenceMemberJoin, conferenceMemberExit, conferenceCompleted, conferenceRecordingAvailable, disconnect, dtmf, gather, initiate, machineDetectionComplete, recordingComplete, recordingAvailable, redirect, transcriptionAvailable, transferAnswer, transferComplete, transferDisconnect.
+ *
+ * @return $this
+ */
+ public function setEventType(?string $event_type): static
+ {
+ if (is_null($event_type)) {
+ throw new InvalidArgumentException('non-nullable event_type cannot be null');
+ }
+ $this->container['event_type'] = $event_type;
+
+ return $this;
+ }
+
+ /**
+ * Gets event_time
+ *
+ * @return \DateTime|null
+ */
+ public function getEventTime(): ?\DateTime
+ {
+ return $this->container['event_time'];
+ }
+
+ /**
+ * Sets event_time
+ *
+ * @param \DateTime|null $event_time The approximate UTC date and time when the event was generated by the Bandwidth server, in ISO 8601 format. This may not be exactly the time of event execution.
+ *
+ * @return $this
+ */
+ public function setEventTime(?\DateTime $event_time): static
+ {
+ if (is_null($event_time)) {
+ throw new InvalidArgumentException('non-nullable event_time cannot be null');
+ }
+ $this->container['event_time'] = $event_time;
+
+ return $this;
+ }
+
+ /**
+ * Gets account_id
+ *
+ * @return string|null
+ */
+ public function getAccountId(): ?string
+ {
+ return $this->container['account_id'];
+ }
+
+ /**
+ * Sets account_id
+ *
+ * @param string|null $account_id The user account associated with the call.
+ *
+ * @return $this
+ */
+ public function setAccountId(?string $account_id): static
+ {
+ if (is_null($account_id)) {
+ throw new InvalidArgumentException('non-nullable account_id cannot be null');
+ }
+ $this->container['account_id'] = $account_id;
+
+ return $this;
+ }
+
+ /**
+ * Gets application_id
+ *
+ * @return string|null
+ */
+ public function getApplicationId(): ?string
+ {
+ return $this->container['application_id'];
+ }
+
+ /**
+ * Sets application_id
+ *
+ * @param string|null $application_id The id of the application associated with the call.
+ *
+ * @return $this
+ */
+ public function setApplicationId(?string $application_id): static
+ {
+ if (is_null($application_id)) {
+ throw new InvalidArgumentException('non-nullable application_id cannot be null');
+ }
+ $this->container['application_id'] = $application_id;
+
+ return $this;
+ }
+
+ /**
+ * Gets from
+ *
+ * @return string|null
+ */
+ public function getFrom(): ?string
+ {
+ return $this->container['from'];
+ }
+
+ /**
+ * Sets from
+ *
+ * @param string|null $from The provided identifier of the caller. Must be a phone number in E.164 format (e.g. +15555555555).
+ *
+ * @return $this
+ */
+ public function setFrom(?string $from): static
+ {
+ if (is_null($from)) {
+ throw new InvalidArgumentException('non-nullable from cannot be null');
+ }
+ $this->container['from'] = $from;
+
+ return $this;
+ }
+
+ /**
+ * Gets to
+ *
+ * @return string|null
+ */
+ public function getTo(): ?string
+ {
+ return $this->container['to'];
+ }
+
+ /**
+ * Sets to
+ *
+ * @param string|null $to The phone number that received the call, in E.164 format (e.g. +15555555555).
+ *
+ * @return $this
+ */
+ public function setTo(?string $to): static
+ {
+ if (is_null($to)) {
+ throw new InvalidArgumentException('non-nullable to cannot be null');
+ }
+ $this->container['to'] = $to;
+
+ return $this;
+ }
+
+ /**
+ * Gets direction
+ *
+ * @return \Bandwidth\Model\CallDirectionEnum|null
+ */
+ public function getDirection(): ?\Bandwidth\Model\CallDirectionEnum
+ {
+ return $this->container['direction'];
+ }
+
+ /**
+ * Sets direction
+ *
+ * @param \Bandwidth\Model\CallDirectionEnum|null $direction direction
+ *
+ * @return $this
+ */
+ public function setDirection(?\Bandwidth\Model\CallDirectionEnum $direction): static
+ {
+ if (is_null($direction)) {
+ throw new InvalidArgumentException('non-nullable direction cannot be null');
+ }
+ $this->container['direction'] = $direction;
+
+ return $this;
+ }
+
+ /**
+ * Gets call_id
+ *
+ * @return string|null
+ */
+ public function getCallId(): ?string
+ {
+ return $this->container['call_id'];
+ }
+
+ /**
+ * Sets call_id
+ *
+ * @param string|null $call_id The call id associated with the event.
+ *
+ * @return $this
+ */
+ public function setCallId(?string $call_id): static
+ {
+ if (is_null($call_id)) {
+ throw new InvalidArgumentException('non-nullable call_id cannot be null');
+ }
+ $this->container['call_id'] = $call_id;
+
+ return $this;
+ }
+
+ /**
+ * Gets call_url
+ *
+ * @return string|null
+ */
+ public function getCallUrl(): ?string
+ {
+ return $this->container['call_url'];
+ }
+
+ /**
+ * Sets call_url
+ *
+ * @param string|null $call_url The URL of the call associated with the event.
+ *
+ * @return $this
+ */
+ public function setCallUrl(?string $call_url): static
+ {
+ if (is_null($call_url)) {
+ throw new InvalidArgumentException('non-nullable call_url cannot be null');
+ }
+ $this->container['call_url'] = $call_url;
+
+ return $this;
+ }
+
+ /**
+ * Gets enqueued_time
+ *
+ * @return \DateTime|null
+ */
+ public function getEnqueuedTime(): ?\DateTime
+ {
+ return $this->container['enqueued_time'];
+ }
+
+ /**
+ * Sets enqueued_time
+ *
+ * @param \DateTime|null $enqueued_time (optional) If call queueing is enabled and this is an outbound call, time the call was queued, in ISO 8601 format.
+ *
+ * @return $this
+ */
+ public function setEnqueuedTime(?\DateTime $enqueued_time): static
+ {
+ if (is_null($enqueued_time)) {
+ array_push($this->openAPINullablesSetToNull, 'enqueued_time');
+ } else {
+ $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+ $index = array_search('enqueued_time', $nullablesSetToNull);
+ if ($index !== FALSE) {
+ unset($nullablesSetToNull[$index]);
+ $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+ }
+ }
+ $this->container['enqueued_time'] = $enqueued_time;
+
+ 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 Time the call was started, in ISO 8601 format.
+ *
+ * @return $this
+ */
+ public function setStartTime(?\DateTime $start_time): static
+ {
+ if (is_null($start_time)) {
+ throw new InvalidArgumentException('non-nullable start_time cannot be null');
+ }
+ $this->container['start_time'] = $start_time;
+
+ return $this;
+ }
+
+ /**
+ * Gets answer_time
+ *
+ * @return \DateTime|null
+ */
+ public function getAnswerTime(): ?\DateTime
+ {
+ return $this->container['answer_time'];
+ }
+
+ /**
+ * Sets answer_time
+ *
+ * @param \DateTime|null $answer_time Time the call was answered, in ISO 8601 format.
+ *
+ * @return $this
+ */
+ public function setAnswerTime(?\DateTime $answer_time): static
+ {
+ if (is_null($answer_time)) {
+ array_push($this->openAPINullablesSetToNull, 'answer_time');
+ } else {
+ $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+ $index = array_search('answer_time', $nullablesSetToNull);
+ if ($index !== FALSE) {
+ unset($nullablesSetToNull[$index]);
+ $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+ }
+ }
+ $this->container['answer_time'] = $answer_time;
+
+ return $this;
+ }
+
+ /**
+ * Gets tag
+ *
+ * @return string|null
+ */
+ public function getTag(): ?string
+ {
+ return $this->container['tag'];
+ }
+
+ /**
+ * Sets tag
+ *
+ * @param string|null $tag (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present.
+ *
+ * @return $this
+ */
+ public function setTag(?string $tag): static
+ {
+ if (is_null($tag)) {
+ array_push($this->openAPINullablesSetToNull, 'tag');
+ } else {
+ $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+ $index = array_search('tag', $nullablesSetToNull);
+ if ($index !== FALSE) {
+ unset($nullablesSetToNull[$index]);
+ $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+ }
+ }
+ $this->container['tag'] = $tag;
+
+ return $this;
+ }
+
+ /**
+ * Gets machine_detection_result
+ *
+ * @return \Bandwidth\Model\MachineDetectionResult|null
+ */
+ public function getMachineDetectionResult(): ?\Bandwidth\Model\MachineDetectionResult
+ {
+ return $this->container['machine_detection_result'];
+ }
+
+ /**
+ * Sets machine_detection_result
+ *
+ * @param \Bandwidth\Model\MachineDetectionResult|null $machine_detection_result machine_detection_result
+ *
+ * @return $this
+ */
+ public function setMachineDetectionResult(?\Bandwidth\Model\MachineDetectionResult $machine_detection_result): static
+ {
+ if (is_null($machine_detection_result)) {
+ array_push($this->openAPINullablesSetToNull, 'machine_detection_result');
+ } else {
+ $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+ $index = array_search('machine_detection_result', $nullablesSetToNull);
+ if ($index !== FALSE) {
+ unset($nullablesSetToNull[$index]);
+ $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+ }
+ }
+ $this->container['machine_detection_result'] = $machine_detection_result;
+
+ 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/AnyOfInterface.php b/src/Model/AnyOfInterface.php
new file mode 100644
index 0000000..9c01010
--- /dev/null
+++ b/src/Model/AnyOfInterface.php
@@ -0,0 +1,66 @@
+
+ */
+ public static function getAnyOfDiscriminatorMappings(): array;
+}
diff --git a/src/Model/AsyncLookupRequest.php b/src/Model/AsyncLookupRequest.php
new file mode 100644
index 0000000..03705e0
--- /dev/null
+++ b/src/Model/AsyncLookupRequest.php
@@ -0,0 +1,388 @@
+
+ */
+class AsyncLookupRequest implements ModelInterface, ArrayAccess, JsonSerializable
+{
+ public const DISCRIMINATOR = null;
+
+ /**
+ * The original name of the model.
+ *
+ * @var string
+ */
+ protected static string $openAPIModelName = 'asyncLookupRequest';
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @var array
+ */
+ protected static array $openAPITypes = [
+ 'phone_numbers' => 'string[]'
+ ];
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @var array
+ */
+ protected static array $openAPIFormats = [
+ 'phone_numbers' => null
+ ];
+
+ /**
+ * Array of nullable properties. Used for (de)serialization
+ *
+ * @var array
+ */
+ protected static array $openAPINullables = [
+ 'phone_numbers' => false
+ ];
+
+ /**
+ * 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 = [
+ 'phone_numbers' => 'phoneNumbers'
+ ];
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @var array
+ */
+ protected static array $setters = [
+ 'phone_numbers' => 'setPhoneNumbers'
+ ];
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @var array
+ */
+ protected static array $getters = [
+ 'phone_numbers' => 'getPhoneNumbers'
+ ];
+
+ /**
+ * {@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('phone_numbers', $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['phone_numbers'] === null) {
+ $invalidProperties[] = "'phone_numbers' can't be null";
+ }
+ return $invalidProperties;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function valid(): bool
+ {
+ return count($this->listInvalidProperties()) === 0;
+ }
+
+
+ /**
+ * Gets phone_numbers
+ *
+ * @return string[]
+ */
+ public function getPhoneNumbers(): array
+ {
+ return $this->container['phone_numbers'];
+ }
+
+ /**
+ * Sets phone_numbers
+ *
+ * @param string[] $phone_numbers Telephone numbers in E.164 format.
+ *
+ * @return $this
+ */
+ public function setPhoneNumbers(array $phone_numbers): static
+ {
+ if (is_null($phone_numbers)) {
+ throw new InvalidArgumentException('non-nullable phone_numbers cannot be null');
+ }
+
+ $this->container['phone_numbers'] = $phone_numbers;
+
+ 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/BlockedWebhook.php b/src/Model/BlockedWebhook.php
new file mode 100644
index 0000000..b0a0c64
--- /dev/null
+++ b/src/Model/BlockedWebhook.php
@@ -0,0 +1,576 @@
+
+ */
+class BlockedWebhook implements ModelInterface, ArrayAccess, JsonSerializable
+{
+ public const DISCRIMINATOR = null;
+
+ /**
+ * The original name of the model.
+ *
+ * @var string
+ */
+ protected static string $openAPIModelName = 'blockedWebhook';
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @var array
+ */
+ protected static array $openAPITypes = [
+ 'account_id' => 'string',
+ 'phone_number' => 'string',
+ 'status' => '\Bandwidth\Model\TfvCallbackStatusEnum',
+ 'internal_ticket_number' => 'string',
+ 'blocked' => 'bool',
+ 'blocked_reason' => 'string'
+ ];
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @var array
+ */
+ protected static array $openAPIFormats = [
+ 'account_id' => null,
+ 'phone_number' => null,
+ 'status' => null,
+ 'internal_ticket_number' => null,
+ 'blocked' => null,
+ 'blocked_reason' => null
+ ];
+
+ /**
+ * Array of nullable properties. Used for (de)serialization
+ *
+ * @var array
+ */
+ protected static array $openAPINullables = [
+ 'account_id' => false,
+ 'phone_number' => false,
+ 'status' => false,
+ 'internal_ticket_number' => false,
+ 'blocked' => false,
+ 'blocked_reason' => false
+ ];
+
+ /**
+ * 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 = [
+ 'account_id' => 'accountId',
+ 'phone_number' => 'phoneNumber',
+ 'status' => 'status',
+ 'internal_ticket_number' => 'internalTicketNumber',
+ 'blocked' => 'blocked',
+ 'blocked_reason' => 'blockedReason'
+ ];
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @var array
+ */
+ protected static array $setters = [
+ 'account_id' => 'setAccountId',
+ 'phone_number' => 'setPhoneNumber',
+ 'status' => 'setStatus',
+ 'internal_ticket_number' => 'setInternalTicketNumber',
+ 'blocked' => 'setBlocked',
+ 'blocked_reason' => 'setBlockedReason'
+ ];
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @var array
+ */
+ protected static array $getters = [
+ 'account_id' => 'getAccountId',
+ 'phone_number' => 'getPhoneNumber',
+ 'status' => 'getStatus',
+ 'internal_ticket_number' => 'getInternalTicketNumber',
+ 'blocked' => 'getBlocked',
+ 'blocked_reason' => 'getBlockedReason'
+ ];
+
+ /**
+ * {@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('account_id', $data ?? [], null);
+ $this->setIfExists('phone_number', $data ?? [], null);
+ $this->setIfExists('status', $data ?? [], null);
+ $this->setIfExists('internal_ticket_number', $data ?? [], null);
+ $this->setIfExists('blocked', $data ?? [], null);
+ $this->setIfExists('blocked_reason', $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 (!is_null($this->container['phone_number']) && (mb_strlen($this->container['phone_number']) > 12)) {
+ $invalidProperties[] = "invalid value for 'phone_number', the character length must be smaller than or equal to 12.";
+ }
+
+ if (!is_null($this->container['phone_number']) && (mb_strlen($this->container['phone_number']) < 12)) {
+ $invalidProperties[] = "invalid value for 'phone_number', the character length must be bigger than or equal to 12.";
+ }
+
+ if (!is_null($this->container['phone_number']) && !preg_match("/^\\+1(800|833|844|855|866|877|888)[2-9]\\d{6}$/", $this->container['phone_number'])) {
+ $invalidProperties[] = "invalid value for 'phone_number', must be conform to the pattern /^\\+1(800|833|844|855|866|877|888)[2-9]\\d{6}$/.";
+ }
+
+ return $invalidProperties;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function valid(): bool
+ {
+ return count($this->listInvalidProperties()) === 0;
+ }
+
+
+ /**
+ * Gets account_id
+ *
+ * @return string|null
+ */
+ public function getAccountId(): ?string
+ {
+ return $this->container['account_id'];
+ }
+
+ /**
+ * Sets account_id
+ *
+ * @param string|null $account_id User's account ID.
+ *
+ * @return $this
+ */
+ public function setAccountId(?string $account_id): static
+ {
+ if (is_null($account_id)) {
+ throw new InvalidArgumentException('non-nullable account_id cannot be null');
+ }
+ $this->container['account_id'] = $account_id;
+
+ return $this;
+ }
+
+ /**
+ * Gets phone_number
+ *
+ * @return string|null
+ */
+ public function getPhoneNumber(): ?string
+ {
+ return $this->container['phone_number'];
+ }
+
+ /**
+ * Sets phone_number
+ *
+ * @param string|null $phone_number Toll-free telephone number in E.164 format.
+ *
+ * @return $this
+ */
+ public function setPhoneNumber(?string $phone_number): static
+ {
+ if (is_null($phone_number)) {
+ throw new InvalidArgumentException('non-nullable phone_number cannot be null');
+ }
+ if ((mb_strlen($phone_number) > 12)) {
+ throw new InvalidArgumentException('invalid length for $phone_number when calling BlockedWebhook., must be smaller than or equal to 12.');
+ }
+ if ((mb_strlen($phone_number) < 12)) {
+ throw new InvalidArgumentException('invalid length for $phone_number when calling BlockedWebhook., must be bigger than or equal to 12.');
+ }
+ if ((!preg_match("/^\\+1(800|833|844|855|866|877|888)[2-9]\\d{6}$/", ObjectSerializer::toString($phone_number)))) {
+ throw new InvalidArgumentException("invalid value for \$phone_number when calling BlockedWebhook., must conform to the pattern /^\\+1(800|833|844|855|866|877|888)[2-9]\\d{6}$/.");
+ }
+
+ $this->container['phone_number'] = $phone_number;
+
+ return $this;
+ }
+
+ /**
+ * Gets status
+ *
+ * @return \Bandwidth\Model\TfvCallbackStatusEnum|null
+ */
+ public function getStatus(): ?\Bandwidth\Model\TfvCallbackStatusEnum
+ {
+ return $this->container['status'];
+ }
+
+ /**
+ * Sets status
+ *
+ * @param \Bandwidth\Model\TfvCallbackStatusEnum|null $status status
+ *
+ * @return $this
+ */
+ public function setStatus(?\Bandwidth\Model\TfvCallbackStatusEnum $status): static
+ {
+ if (is_null($status)) {
+ throw new InvalidArgumentException('non-nullable status cannot be null');
+ }
+ $this->container['status'] = $status;
+
+ return $this;
+ }
+
+ /**
+ * Gets internal_ticket_number
+ *
+ * @return string|null
+ */
+ public function getInternalTicketNumber(): ?string
+ {
+ return $this->container['internal_ticket_number'];
+ }
+
+ /**
+ * Sets internal_ticket_number
+ *
+ * @param string|null $internal_ticket_number Unique identifier (UUID) generated by Bandwidth to assist in tracking the verification status of a toll-free number.
+ *
+ * @return $this
+ */
+ public function setInternalTicketNumber(?string $internal_ticket_number): static
+ {
+ if (is_null($internal_ticket_number)) {
+ throw new InvalidArgumentException('non-nullable internal_ticket_number cannot be null');
+ }
+ $this->container['internal_ticket_number'] = $internal_ticket_number;
+
+ return $this;
+ }
+
+ /**
+ * Gets blocked
+ *
+ * @return bool|null
+ */
+ public function getBlocked(): ?bool
+ {
+ return $this->container['blocked'];
+ }
+
+ /**
+ * Sets blocked
+ *
+ * @param bool|null $blocked Whether a Toll-Free Verification is blocked. This attribute will only be defined when the number is blocked.
+ *
+ * @return $this
+ */
+ public function setBlocked(?bool $blocked): static
+ {
+ if (is_null($blocked)) {
+ throw new InvalidArgumentException('non-nullable blocked cannot be null');
+ }
+ $this->container['blocked'] = $blocked;
+
+ return $this;
+ }
+
+ /**
+ * Gets blocked_reason
+ *
+ * @return string|null
+ */
+ public function getBlockedReason(): ?string
+ {
+ return $this->container['blocked_reason'];
+ }
+
+ /**
+ * Sets blocked_reason
+ *
+ * @param string|null $blocked_reason The reason why the Toll-Free Verification is blocked. This attribute will only be defined when the number is blocked.
+ *
+ * @return $this
+ */
+ public function setBlockedReason(?string $blocked_reason): static
+ {
+ if (is_null($blocked_reason)) {
+ throw new InvalidArgumentException('non-nullable blocked_reason cannot be null');
+ }
+ $this->container['blocked_reason'] = $blocked_reason;
+
+ 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/BridgeCompleteCallback.php b/src/Model/BridgeCompleteCallback.php
new file mode 100644
index 0000000..73601fe
--- /dev/null
+++ b/src/Model/BridgeCompleteCallback.php
@@ -0,0 +1,930 @@
+
+ */
+class BridgeCompleteCallback implements ModelInterface, ArrayAccess, JsonSerializable
+{
+ public const DISCRIMINATOR = null;
+
+ /**
+ * The original name of the model.
+ *
+ * @var string
+ */
+ protected static string $openAPIModelName = 'bridgeCompleteCallback';
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @var array
+ */
+ protected static array $openAPITypes = [
+ 'event_type' => 'string',
+ 'event_time' => '\DateTime',
+ 'account_id' => 'string',
+ 'application_id' => 'string',
+ 'from' => 'string',
+ 'to' => 'string',
+ 'direction' => '\Bandwidth\Model\CallDirectionEnum',
+ 'call_id' => 'string',
+ 'call_url' => 'string',
+ 'enqueued_time' => '\DateTime',
+ 'start_time' => '\DateTime',
+ 'answer_time' => '\DateTime',
+ 'tag' => 'string',
+ 'cause' => 'string',
+ 'error_message' => 'string',
+ 'error_id' => 'string'
+ ];
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @var array
+ */
+ protected static array $openAPIFormats = [
+ 'event_type' => null,
+ 'event_time' => 'date-time',
+ 'account_id' => null,
+ 'application_id' => null,
+ 'from' => null,
+ 'to' => null,
+ 'direction' => null,
+ 'call_id' => null,
+ 'call_url' => 'uri',
+ 'enqueued_time' => 'date-time',
+ 'start_time' => 'date-time',
+ 'answer_time' => 'date-time',
+ 'tag' => null,
+ 'cause' => null,
+ 'error_message' => null,
+ 'error_id' => null
+ ];
+
+ /**
+ * Array of nullable properties. Used for (de)serialization
+ *
+ * @var array
+ */
+ protected static array $openAPINullables = [
+ 'event_type' => false,
+ 'event_time' => false,
+ 'account_id' => false,
+ 'application_id' => false,
+ 'from' => false,
+ 'to' => false,
+ 'direction' => false,
+ 'call_id' => false,
+ 'call_url' => false,
+ 'enqueued_time' => true,
+ 'start_time' => false,
+ 'answer_time' => true,
+ 'tag' => true,
+ 'cause' => false,
+ 'error_message' => true,
+ 'error_id' => 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 = [
+ 'event_type' => 'eventType',
+ 'event_time' => 'eventTime',
+ 'account_id' => 'accountId',
+ 'application_id' => 'applicationId',
+ 'from' => 'from',
+ 'to' => 'to',
+ 'direction' => 'direction',
+ 'call_id' => 'callId',
+ 'call_url' => 'callUrl',
+ 'enqueued_time' => 'enqueuedTime',
+ 'start_time' => 'startTime',
+ 'answer_time' => 'answerTime',
+ 'tag' => 'tag',
+ 'cause' => 'cause',
+ 'error_message' => 'errorMessage',
+ 'error_id' => 'errorId'
+ ];
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @var array
+ */
+ protected static array $setters = [
+ 'event_type' => 'setEventType',
+ 'event_time' => 'setEventTime',
+ 'account_id' => 'setAccountId',
+ 'application_id' => 'setApplicationId',
+ 'from' => 'setFrom',
+ 'to' => 'setTo',
+ 'direction' => 'setDirection',
+ 'call_id' => 'setCallId',
+ 'call_url' => 'setCallUrl',
+ 'enqueued_time' => 'setEnqueuedTime',
+ 'start_time' => 'setStartTime',
+ 'answer_time' => 'setAnswerTime',
+ 'tag' => 'setTag',
+ 'cause' => 'setCause',
+ 'error_message' => 'setErrorMessage',
+ 'error_id' => 'setErrorId'
+ ];
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @var array
+ */
+ protected static array $getters = [
+ 'event_type' => 'getEventType',
+ 'event_time' => 'getEventTime',
+ 'account_id' => 'getAccountId',
+ 'application_id' => 'getApplicationId',
+ 'from' => 'getFrom',
+ 'to' => 'getTo',
+ 'direction' => 'getDirection',
+ 'call_id' => 'getCallId',
+ 'call_url' => 'getCallUrl',
+ 'enqueued_time' => 'getEnqueuedTime',
+ 'start_time' => 'getStartTime',
+ 'answer_time' => 'getAnswerTime',
+ 'tag' => 'getTag',
+ 'cause' => 'getCause',
+ 'error_message' => 'getErrorMessage',
+ 'error_id' => 'getErrorId'
+ ];
+
+ /**
+ * {@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('event_type', $data ?? [], null);
+ $this->setIfExists('event_time', $data ?? [], null);
+ $this->setIfExists('account_id', $data ?? [], null);
+ $this->setIfExists('application_id', $data ?? [], null);
+ $this->setIfExists('from', $data ?? [], null);
+ $this->setIfExists('to', $data ?? [], null);
+ $this->setIfExists('direction', $data ?? [], null);
+ $this->setIfExists('call_id', $data ?? [], null);
+ $this->setIfExists('call_url', $data ?? [], null);
+ $this->setIfExists('enqueued_time', $data ?? [], null);
+ $this->setIfExists('start_time', $data ?? [], null);
+ $this->setIfExists('answer_time', $data ?? [], null);
+ $this->setIfExists('tag', $data ?? [], null);
+ $this->setIfExists('cause', $data ?? [], null);
+ $this->setIfExists('error_message', $data ?? [], null);
+ $this->setIfExists('error_id', $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 = [];
+
+ return $invalidProperties;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function valid(): bool
+ {
+ return count($this->listInvalidProperties()) === 0;
+ }
+
+
+ /**
+ * Gets event_type
+ *
+ * @return string|null
+ */
+ public function getEventType(): ?string
+ {
+ return $this->container['event_type'];
+ }
+
+ /**
+ * Sets event_type
+ *
+ * @param string|null $event_type The event type, value can be one of the following: answer, bridgeComplete, bridgeTargetComplete, conferenceCreated, conferenceRedirect, conferenceMemberJoin, conferenceMemberExit, conferenceCompleted, conferenceRecordingAvailable, disconnect, dtmf, gather, initiate, machineDetectionComplete, recordingComplete, recordingAvailable, redirect, transcriptionAvailable, transferAnswer, transferComplete, transferDisconnect.
+ *
+ * @return $this
+ */
+ public function setEventType(?string $event_type): static
+ {
+ if (is_null($event_type)) {
+ throw new InvalidArgumentException('non-nullable event_type cannot be null');
+ }
+ $this->container['event_type'] = $event_type;
+
+ return $this;
+ }
+
+ /**
+ * Gets event_time
+ *
+ * @return \DateTime|null
+ */
+ public function getEventTime(): ?\DateTime
+ {
+ return $this->container['event_time'];
+ }
+
+ /**
+ * Sets event_time
+ *
+ * @param \DateTime|null $event_time The approximate UTC date and time when the event was generated by the Bandwidth server, in ISO 8601 format. This may not be exactly the time of event execution.
+ *
+ * @return $this
+ */
+ public function setEventTime(?\DateTime $event_time): static
+ {
+ if (is_null($event_time)) {
+ throw new InvalidArgumentException('non-nullable event_time cannot be null');
+ }
+ $this->container['event_time'] = $event_time;
+
+ return $this;
+ }
+
+ /**
+ * Gets account_id
+ *
+ * @return string|null
+ */
+ public function getAccountId(): ?string
+ {
+ return $this->container['account_id'];
+ }
+
+ /**
+ * Sets account_id
+ *
+ * @param string|null $account_id The user account associated with the call.
+ *
+ * @return $this
+ */
+ public function setAccountId(?string $account_id): static
+ {
+ if (is_null($account_id)) {
+ throw new InvalidArgumentException('non-nullable account_id cannot be null');
+ }
+ $this->container['account_id'] = $account_id;
+
+ return $this;
+ }
+
+ /**
+ * Gets application_id
+ *
+ * @return string|null
+ */
+ public function getApplicationId(): ?string
+ {
+ return $this->container['application_id'];
+ }
+
+ /**
+ * Sets application_id
+ *
+ * @param string|null $application_id The id of the application associated with the call.
+ *
+ * @return $this
+ */
+ public function setApplicationId(?string $application_id): static
+ {
+ if (is_null($application_id)) {
+ throw new InvalidArgumentException('non-nullable application_id cannot be null');
+ }
+ $this->container['application_id'] = $application_id;
+
+ return $this;
+ }
+
+ /**
+ * Gets from
+ *
+ * @return string|null
+ */
+ public function getFrom(): ?string
+ {
+ return $this->container['from'];
+ }
+
+ /**
+ * Sets from
+ *
+ * @param string|null $from The provided identifier of the caller. Must be a phone number in E.164 format (e.g. +15555555555).
+ *
+ * @return $this
+ */
+ public function setFrom(?string $from): static
+ {
+ if (is_null($from)) {
+ throw new InvalidArgumentException('non-nullable from cannot be null');
+ }
+ $this->container['from'] = $from;
+
+ return $this;
+ }
+
+ /**
+ * Gets to
+ *
+ * @return string|null
+ */
+ public function getTo(): ?string
+ {
+ return $this->container['to'];
+ }
+
+ /**
+ * Sets to
+ *
+ * @param string|null $to The phone number that received the call, in E.164 format (e.g. +15555555555).
+ *
+ * @return $this
+ */
+ public function setTo(?string $to): static
+ {
+ if (is_null($to)) {
+ throw new InvalidArgumentException('non-nullable to cannot be null');
+ }
+ $this->container['to'] = $to;
+
+ return $this;
+ }
+
+ /**
+ * Gets direction
+ *
+ * @return \Bandwidth\Model\CallDirectionEnum|null
+ */
+ public function getDirection(): ?\Bandwidth\Model\CallDirectionEnum
+ {
+ return $this->container['direction'];
+ }
+
+ /**
+ * Sets direction
+ *
+ * @param \Bandwidth\Model\CallDirectionEnum|null $direction direction
+ *
+ * @return $this
+ */
+ public function setDirection(?\Bandwidth\Model\CallDirectionEnum $direction): static
+ {
+ if (is_null($direction)) {
+ throw new InvalidArgumentException('non-nullable direction cannot be null');
+ }
+ $this->container['direction'] = $direction;
+
+ return $this;
+ }
+
+ /**
+ * Gets call_id
+ *
+ * @return string|null
+ */
+ public function getCallId(): ?string
+ {
+ return $this->container['call_id'];
+ }
+
+ /**
+ * Sets call_id
+ *
+ * @param string|null $call_id The call id associated with the event.
+ *
+ * @return $this
+ */
+ public function setCallId(?string $call_id): static
+ {
+ if (is_null($call_id)) {
+ throw new InvalidArgumentException('non-nullable call_id cannot be null');
+ }
+ $this->container['call_id'] = $call_id;
+
+ return $this;
+ }
+
+ /**
+ * Gets call_url
+ *
+ * @return string|null
+ */
+ public function getCallUrl(): ?string
+ {
+ return $this->container['call_url'];
+ }
+
+ /**
+ * Sets call_url
+ *
+ * @param string|null $call_url The URL of the call associated with the event.
+ *
+ * @return $this
+ */
+ public function setCallUrl(?string $call_url): static
+ {
+ if (is_null($call_url)) {
+ throw new InvalidArgumentException('non-nullable call_url cannot be null');
+ }
+ $this->container['call_url'] = $call_url;
+
+ return $this;
+ }
+
+ /**
+ * Gets enqueued_time
+ *
+ * @return \DateTime|null
+ */
+ public function getEnqueuedTime(): ?\DateTime
+ {
+ return $this->container['enqueued_time'];
+ }
+
+ /**
+ * Sets enqueued_time
+ *
+ * @param \DateTime|null $enqueued_time (optional) If call queueing is enabled and this is an outbound call, time the call was queued, in ISO 8601 format.
+ *
+ * @return $this
+ */
+ public function setEnqueuedTime(?\DateTime $enqueued_time): static
+ {
+ if (is_null($enqueued_time)) {
+ array_push($this->openAPINullablesSetToNull, 'enqueued_time');
+ } else {
+ $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+ $index = array_search('enqueued_time', $nullablesSetToNull);
+ if ($index !== FALSE) {
+ unset($nullablesSetToNull[$index]);
+ $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+ }
+ }
+ $this->container['enqueued_time'] = $enqueued_time;
+
+ 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 Time the call was started, in ISO 8601 format.
+ *
+ * @return $this
+ */
+ public function setStartTime(?\DateTime $start_time): static
+ {
+ if (is_null($start_time)) {
+ throw new InvalidArgumentException('non-nullable start_time cannot be null');
+ }
+ $this->container['start_time'] = $start_time;
+
+ return $this;
+ }
+
+ /**
+ * Gets answer_time
+ *
+ * @return \DateTime|null
+ */
+ public function getAnswerTime(): ?\DateTime
+ {
+ return $this->container['answer_time'];
+ }
+
+ /**
+ * Sets answer_time
+ *
+ * @param \DateTime|null $answer_time Time the call was answered, in ISO 8601 format.
+ *
+ * @return $this
+ */
+ public function setAnswerTime(?\DateTime $answer_time): static
+ {
+ if (is_null($answer_time)) {
+ array_push($this->openAPINullablesSetToNull, 'answer_time');
+ } else {
+ $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+ $index = array_search('answer_time', $nullablesSetToNull);
+ if ($index !== FALSE) {
+ unset($nullablesSetToNull[$index]);
+ $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+ }
+ }
+ $this->container['answer_time'] = $answer_time;
+
+ return $this;
+ }
+
+ /**
+ * Gets tag
+ *
+ * @return string|null
+ */
+ public function getTag(): ?string
+ {
+ return $this->container['tag'];
+ }
+
+ /**
+ * Sets tag
+ *
+ * @param string|null $tag (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present.
+ *
+ * @return $this
+ */
+ public function setTag(?string $tag): static
+ {
+ if (is_null($tag)) {
+ array_push($this->openAPINullablesSetToNull, 'tag');
+ } else {
+ $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+ $index = array_search('tag', $nullablesSetToNull);
+ if ($index !== FALSE) {
+ unset($nullablesSetToNull[$index]);
+ $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+ }
+ }
+ $this->container['tag'] = $tag;
+
+ return $this;
+ }
+
+ /**
+ * Gets cause
+ *
+ * @return string|null
+ */
+ public function getCause(): ?string
+ {
+ return $this->container['cause'];
+ }
+
+ /**
+ * Sets cause
+ *
+ * @param string|null $cause Reason the call failed - hangup, busy, timeout, cancel, rejected, callback-error, invalid-bxml, application-error, account-limit, node-capacity-exceeded, error, or unknown.
+ *
+ * @return $this
+ */
+ public function setCause(?string $cause): static
+ {
+ if (is_null($cause)) {
+ throw new InvalidArgumentException('non-nullable cause cannot be null');
+ }
+ $this->container['cause'] = $cause;
+
+ return $this;
+ }
+
+ /**
+ * Gets error_message
+ *
+ * @return string|null
+ */
+ public function getErrorMessage(): ?string
+ {
+ return $this->container['error_message'];
+ }
+
+ /**
+ * Sets error_message
+ *
+ * @param string|null $error_message Text explaining the reason that caused the call to fail in case of errors.
+ *
+ * @return $this
+ */
+ public function setErrorMessage(?string $error_message): static
+ {
+ if (is_null($error_message)) {
+ array_push($this->openAPINullablesSetToNull, 'error_message');
+ } else {
+ $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+ $index = array_search('error_message', $nullablesSetToNull);
+ if ($index !== FALSE) {
+ unset($nullablesSetToNull[$index]);
+ $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+ }
+ }
+ $this->container['error_message'] = $error_message;
+
+ return $this;
+ }
+
+ /**
+ * Gets error_id
+ *
+ * @return string|null
+ */
+ public function getErrorId(): ?string
+ {
+ return $this->container['error_id'];
+ }
+
+ /**
+ * Sets error_id
+ *
+ * @param string|null $error_id Bandwidth's internal id that references the error event.
+ *
+ * @return $this
+ */
+ public function setErrorId(?string $error_id): static
+ {
+ if (is_null($error_id)) {
+ array_push($this->openAPINullablesSetToNull, 'error_id');
+ } else {
+ $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+ $index = array_search('error_id', $nullablesSetToNull);
+ if ($index !== FALSE) {
+ unset($nullablesSetToNull[$index]);
+ $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+ }
+ }
+ $this->container['error_id'] = $error_id;
+
+ 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/BridgeTargetCompleteCallback.php b/src/Model/BridgeTargetCompleteCallback.php
new file mode 100644
index 0000000..3abf34e
--- /dev/null
+++ b/src/Model/BridgeTargetCompleteCallback.php
@@ -0,0 +1,814 @@
+
+ */
+class BridgeTargetCompleteCallback implements ModelInterface, ArrayAccess, JsonSerializable
+{
+ public const DISCRIMINATOR = null;
+
+ /**
+ * The original name of the model.
+ *
+ * @var string
+ */
+ protected static string $openAPIModelName = 'bridgeTargetCompleteCallback';
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @var array
+ */
+ protected static array $openAPITypes = [
+ 'event_type' => 'string',
+ 'event_time' => '\DateTime',
+ 'account_id' => 'string',
+ 'application_id' => 'string',
+ 'from' => 'string',
+ 'to' => 'string',
+ 'direction' => '\Bandwidth\Model\CallDirectionEnum',
+ 'call_id' => 'string',
+ 'call_url' => 'string',
+ 'enqueued_time' => '\DateTime',
+ 'start_time' => '\DateTime',
+ 'answer_time' => '\DateTime',
+ 'tag' => 'string'
+ ];
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @var array
+ */
+ protected static array $openAPIFormats = [
+ 'event_type' => null,
+ 'event_time' => 'date-time',
+ 'account_id' => null,
+ 'application_id' => null,
+ 'from' => null,
+ 'to' => null,
+ 'direction' => null,
+ 'call_id' => null,
+ 'call_url' => 'uri',
+ 'enqueued_time' => 'date-time',
+ 'start_time' => 'date-time',
+ 'answer_time' => 'date-time',
+ 'tag' => null
+ ];
+
+ /**
+ * Array of nullable properties. Used for (de)serialization
+ *
+ * @var array
+ */
+ protected static array $openAPINullables = [
+ 'event_type' => false,
+ 'event_time' => false,
+ 'account_id' => false,
+ 'application_id' => false,
+ 'from' => false,
+ 'to' => false,
+ 'direction' => false,
+ 'call_id' => false,
+ 'call_url' => false,
+ 'enqueued_time' => true,
+ 'start_time' => false,
+ 'answer_time' => true,
+ 'tag' => 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 = [
+ 'event_type' => 'eventType',
+ 'event_time' => 'eventTime',
+ 'account_id' => 'accountId',
+ 'application_id' => 'applicationId',
+ 'from' => 'from',
+ 'to' => 'to',
+ 'direction' => 'direction',
+ 'call_id' => 'callId',
+ 'call_url' => 'callUrl',
+ 'enqueued_time' => 'enqueuedTime',
+ 'start_time' => 'startTime',
+ 'answer_time' => 'answerTime',
+ 'tag' => 'tag'
+ ];
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @var array
+ */
+ protected static array $setters = [
+ 'event_type' => 'setEventType',
+ 'event_time' => 'setEventTime',
+ 'account_id' => 'setAccountId',
+ 'application_id' => 'setApplicationId',
+ 'from' => 'setFrom',
+ 'to' => 'setTo',
+ 'direction' => 'setDirection',
+ 'call_id' => 'setCallId',
+ 'call_url' => 'setCallUrl',
+ 'enqueued_time' => 'setEnqueuedTime',
+ 'start_time' => 'setStartTime',
+ 'answer_time' => 'setAnswerTime',
+ 'tag' => 'setTag'
+ ];
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @var array
+ */
+ protected static array $getters = [
+ 'event_type' => 'getEventType',
+ 'event_time' => 'getEventTime',
+ 'account_id' => 'getAccountId',
+ 'application_id' => 'getApplicationId',
+ 'from' => 'getFrom',
+ 'to' => 'getTo',
+ 'direction' => 'getDirection',
+ 'call_id' => 'getCallId',
+ 'call_url' => 'getCallUrl',
+ 'enqueued_time' => 'getEnqueuedTime',
+ 'start_time' => 'getStartTime',
+ 'answer_time' => 'getAnswerTime',
+ 'tag' => 'getTag'
+ ];
+
+ /**
+ * {@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('event_type', $data ?? [], null);
+ $this->setIfExists('event_time', $data ?? [], null);
+ $this->setIfExists('account_id', $data ?? [], null);
+ $this->setIfExists('application_id', $data ?? [], null);
+ $this->setIfExists('from', $data ?? [], null);
+ $this->setIfExists('to', $data ?? [], null);
+ $this->setIfExists('direction', $data ?? [], null);
+ $this->setIfExists('call_id', $data ?? [], null);
+ $this->setIfExists('call_url', $data ?? [], null);
+ $this->setIfExists('enqueued_time', $data ?? [], null);
+ $this->setIfExists('start_time', $data ?? [], null);
+ $this->setIfExists('answer_time', $data ?? [], null);
+ $this->setIfExists('tag', $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 = [];
+
+ return $invalidProperties;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function valid(): bool
+ {
+ return count($this->listInvalidProperties()) === 0;
+ }
+
+
+ /**
+ * Gets event_type
+ *
+ * @return string|null
+ */
+ public function getEventType(): ?string
+ {
+ return $this->container['event_type'];
+ }
+
+ /**
+ * Sets event_type
+ *
+ * @param string|null $event_type The event type, value can be one of the following: answer, bridgeComplete, bridgeTargetComplete, conferenceCreated, conferenceRedirect, conferenceMemberJoin, conferenceMemberExit, conferenceCompleted, conferenceRecordingAvailable, disconnect, dtmf, gather, initiate, machineDetectionComplete, recordingComplete, recordingAvailable, redirect, transcriptionAvailable, transferAnswer, transferComplete, transferDisconnect.
+ *
+ * @return $this
+ */
+ public function setEventType(?string $event_type): static
+ {
+ if (is_null($event_type)) {
+ throw new InvalidArgumentException('non-nullable event_type cannot be null');
+ }
+ $this->container['event_type'] = $event_type;
+
+ return $this;
+ }
+
+ /**
+ * Gets event_time
+ *
+ * @return \DateTime|null
+ */
+ public function getEventTime(): ?\DateTime
+ {
+ return $this->container['event_time'];
+ }
+
+ /**
+ * Sets event_time
+ *
+ * @param \DateTime|null $event_time The approximate UTC date and time when the event was generated by the Bandwidth server, in ISO 8601 format. This may not be exactly the time of event execution.
+ *
+ * @return $this
+ */
+ public function setEventTime(?\DateTime $event_time): static
+ {
+ if (is_null($event_time)) {
+ throw new InvalidArgumentException('non-nullable event_time cannot be null');
+ }
+ $this->container['event_time'] = $event_time;
+
+ return $this;
+ }
+
+ /**
+ * Gets account_id
+ *
+ * @return string|null
+ */
+ public function getAccountId(): ?string
+ {
+ return $this->container['account_id'];
+ }
+
+ /**
+ * Sets account_id
+ *
+ * @param string|null $account_id The user account associated with the call.
+ *
+ * @return $this
+ */
+ public function setAccountId(?string $account_id): static
+ {
+ if (is_null($account_id)) {
+ throw new InvalidArgumentException('non-nullable account_id cannot be null');
+ }
+ $this->container['account_id'] = $account_id;
+
+ return $this;
+ }
+
+ /**
+ * Gets application_id
+ *
+ * @return string|null
+ */
+ public function getApplicationId(): ?string
+ {
+ return $this->container['application_id'];
+ }
+
+ /**
+ * Sets application_id
+ *
+ * @param string|null $application_id The id of the application associated with the call.
+ *
+ * @return $this
+ */
+ public function setApplicationId(?string $application_id): static
+ {
+ if (is_null($application_id)) {
+ throw new InvalidArgumentException('non-nullable application_id cannot be null');
+ }
+ $this->container['application_id'] = $application_id;
+
+ return $this;
+ }
+
+ /**
+ * Gets from
+ *
+ * @return string|null
+ */
+ public function getFrom(): ?string
+ {
+ return $this->container['from'];
+ }
+
+ /**
+ * Sets from
+ *
+ * @param string|null $from The provided identifier of the caller. Must be a phone number in E.164 format (e.g. +15555555555).
+ *
+ * @return $this
+ */
+ public function setFrom(?string $from): static
+ {
+ if (is_null($from)) {
+ throw new InvalidArgumentException('non-nullable from cannot be null');
+ }
+ $this->container['from'] = $from;
+
+ return $this;
+ }
+
+ /**
+ * Gets to
+ *
+ * @return string|null
+ */
+ public function getTo(): ?string
+ {
+ return $this->container['to'];
+ }
+
+ /**
+ * Sets to
+ *
+ * @param string|null $to The phone number that received the call, in E.164 format (e.g. +15555555555).
+ *
+ * @return $this
+ */
+ public function setTo(?string $to): static
+ {
+ if (is_null($to)) {
+ throw new InvalidArgumentException('non-nullable to cannot be null');
+ }
+ $this->container['to'] = $to;
+
+ return $this;
+ }
+
+ /**
+ * Gets direction
+ *
+ * @return \Bandwidth\Model\CallDirectionEnum|null
+ */
+ public function getDirection(): ?\Bandwidth\Model\CallDirectionEnum
+ {
+ return $this->container['direction'];
+ }
+
+ /**
+ * Sets direction
+ *
+ * @param \Bandwidth\Model\CallDirectionEnum|null $direction direction
+ *
+ * @return $this
+ */
+ public function setDirection(?\Bandwidth\Model\CallDirectionEnum $direction): static
+ {
+ if (is_null($direction)) {
+ throw new InvalidArgumentException('non-nullable direction cannot be null');
+ }
+ $this->container['direction'] = $direction;
+
+ return $this;
+ }
+
+ /**
+ * Gets call_id
+ *
+ * @return string|null
+ */
+ public function getCallId(): ?string
+ {
+ return $this->container['call_id'];
+ }
+
+ /**
+ * Sets call_id
+ *
+ * @param string|null $call_id The call id associated with the event.
+ *
+ * @return $this
+ */
+ public function setCallId(?string $call_id): static
+ {
+ if (is_null($call_id)) {
+ throw new InvalidArgumentException('non-nullable call_id cannot be null');
+ }
+ $this->container['call_id'] = $call_id;
+
+ return $this;
+ }
+
+ /**
+ * Gets call_url
+ *
+ * @return string|null
+ */
+ public function getCallUrl(): ?string
+ {
+ return $this->container['call_url'];
+ }
+
+ /**
+ * Sets call_url
+ *
+ * @param string|null $call_url The URL of the call associated with the event.
+ *
+ * @return $this
+ */
+ public function setCallUrl(?string $call_url): static
+ {
+ if (is_null($call_url)) {
+ throw new InvalidArgumentException('non-nullable call_url cannot be null');
+ }
+ $this->container['call_url'] = $call_url;
+
+ return $this;
+ }
+
+ /**
+ * Gets enqueued_time
+ *
+ * @return \DateTime|null
+ */
+ public function getEnqueuedTime(): ?\DateTime
+ {
+ return $this->container['enqueued_time'];
+ }
+
+ /**
+ * Sets enqueued_time
+ *
+ * @param \DateTime|null $enqueued_time (optional) If call queueing is enabled and this is an outbound call, time the call was queued, in ISO 8601 format.
+ *
+ * @return $this
+ */
+ public function setEnqueuedTime(?\DateTime $enqueued_time): static
+ {
+ if (is_null($enqueued_time)) {
+ array_push($this->openAPINullablesSetToNull, 'enqueued_time');
+ } else {
+ $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+ $index = array_search('enqueued_time', $nullablesSetToNull);
+ if ($index !== FALSE) {
+ unset($nullablesSetToNull[$index]);
+ $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+ }
+ }
+ $this->container['enqueued_time'] = $enqueued_time;
+
+ 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 Time the call was started, in ISO 8601 format.
+ *
+ * @return $this
+ */
+ public function setStartTime(?\DateTime $start_time): static
+ {
+ if (is_null($start_time)) {
+ throw new InvalidArgumentException('non-nullable start_time cannot be null');
+ }
+ $this->container['start_time'] = $start_time;
+
+ return $this;
+ }
+
+ /**
+ * Gets answer_time
+ *
+ * @return \DateTime|null
+ */
+ public function getAnswerTime(): ?\DateTime
+ {
+ return $this->container['answer_time'];
+ }
+
+ /**
+ * Sets answer_time
+ *
+ * @param \DateTime|null $answer_time Time the call was answered, in ISO 8601 format.
+ *
+ * @return $this
+ */
+ public function setAnswerTime(?\DateTime $answer_time): static
+ {
+ if (is_null($answer_time)) {
+ array_push($this->openAPINullablesSetToNull, 'answer_time');
+ } else {
+ $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+ $index = array_search('answer_time', $nullablesSetToNull);
+ if ($index !== FALSE) {
+ unset($nullablesSetToNull[$index]);
+ $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+ }
+ }
+ $this->container['answer_time'] = $answer_time;
+
+ return $this;
+ }
+
+ /**
+ * Gets tag
+ *
+ * @return string|null
+ */
+ public function getTag(): ?string
+ {
+ return $this->container['tag'];
+ }
+
+ /**
+ * Sets tag
+ *
+ * @param string|null $tag (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present.
+ *
+ * @return $this
+ */
+ public function setTag(?string $tag): static
+ {
+ if (is_null($tag)) {
+ array_push($this->openAPINullablesSetToNull, 'tag');
+ } else {
+ $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+ $index = array_search('tag', $nullablesSetToNull);
+ if ($index !== FALSE) {
+ unset($nullablesSetToNull[$index]);
+ $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+ }
+ }
+ $this->container['tag'] = $tag;
+
+ 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/BrtcError.php b/src/Model/BrtcError.php
new file mode 100644
index 0000000..9d787bb
--- /dev/null
+++ b/src/Model/BrtcError.php
@@ -0,0 +1,526 @@
+
+ */
+class BrtcError implements ModelInterface, ArrayAccess, JsonSerializable
+{
+ public const DISCRIMINATOR = null;
+
+ /**
+ * The original name of the model.
+ *
+ * @var string
+ */
+ protected static string $openAPIModelName = 'brtcError';
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @var array
+ */
+ protected static array $openAPITypes = [
+ 'id' => 'string',
+ 'type' => 'string',
+ 'description' => 'string',
+ 'code' => 'string',
+ 'source' => '\Bandwidth\Model\BrtcErrorSource'
+ ];
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @var array
+ */
+ protected static array $openAPIFormats = [
+ 'id' => 'uuid',
+ 'type' => null,
+ 'description' => null,
+ 'code' => null,
+ 'source' => null
+ ];
+
+ /**
+ * Array of nullable properties. Used for (de)serialization
+ *
+ * @var array
+ */
+ protected static array $openAPINullables = [
+ 'id' => false,
+ 'type' => false,
+ 'description' => false,
+ 'code' => false,
+ 'source' => false
+ ];
+
+ /**
+ * 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 = [
+ 'id' => 'id',
+ 'type' => 'type',
+ 'description' => 'description',
+ 'code' => 'code',
+ 'source' => 'source'
+ ];
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @var array
+ */
+ protected static array $setters = [
+ 'id' => 'setId',
+ 'type' => 'setType',
+ 'description' => 'setDescription',
+ 'code' => 'setCode',
+ 'source' => 'setSource'
+ ];
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @var array
+ */
+ protected static array $getters = [
+ 'id' => 'getId',
+ 'type' => 'getType',
+ 'description' => 'getDescription',
+ 'code' => 'getCode',
+ 'source' => 'getSource'
+ ];
+
+ /**
+ * {@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('id', $data ?? [], null);
+ $this->setIfExists('type', $data ?? [], null);
+ $this->setIfExists('description', $data ?? [], null);
+ $this->setIfExists('code', $data ?? [], null);
+ $this->setIfExists('source', $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['type'] === null) {
+ $invalidProperties[] = "'type' can't be null";
+ }
+ if ($this->container['description'] === null) {
+ $invalidProperties[] = "'description' can't be null";
+ }
+ return $invalidProperties;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function valid(): bool
+ {
+ return count($this->listInvalidProperties()) === 0;
+ }
+
+
+ /**
+ * Gets id
+ *
+ * @return string|null
+ */
+ public function getId(): ?string
+ {
+ return $this->container['id'];
+ }
+
+ /**
+ * Sets id
+ *
+ * @param string|null $id A unique identifier for the error.
+ *
+ * @return $this
+ */
+ public function setId(?string $id): static
+ {
+ if (is_null($id)) {
+ throw new InvalidArgumentException('non-nullable id cannot be null');
+ }
+ $this->container['id'] = $id;
+
+ return $this;
+ }
+
+ /**
+ * Gets type
+ *
+ * @return string
+ */
+ public function getType(): string
+ {
+ return $this->container['type'];
+ }
+
+ /**
+ * Sets type
+ *
+ * @param string $type The type of error.
+ *
+ * @return $this
+ */
+ public function setType(string $type): static
+ {
+ if (is_null($type)) {
+ throw new InvalidArgumentException('non-nullable type cannot be null');
+ }
+ $this->container['type'] = $type;
+
+ return $this;
+ }
+
+ /**
+ * Gets description
+ *
+ * @return string
+ */
+ public function getDescription(): string
+ {
+ return $this->container['description'];
+ }
+
+ /**
+ * Sets description
+ *
+ * @param string $description A description of the error.
+ *
+ * @return $this
+ */
+ public function setDescription(string $description): static
+ {
+ if (is_null($description)) {
+ throw new InvalidArgumentException('non-nullable description cannot be null');
+ }
+ $this->container['description'] = $description;
+
+ return $this;
+ }
+
+ /**
+ * Gets code
+ *
+ * @return string|null
+ */
+ public function getCode(): ?string
+ {
+ return $this->container['code'];
+ }
+
+ /**
+ * Sets code
+ *
+ * @param string|null $code A code that uniquely identifies the error.
+ *
+ * @return $this
+ */
+ public function setCode(?string $code): static
+ {
+ if (is_null($code)) {
+ throw new InvalidArgumentException('non-nullable code cannot be null');
+ }
+ $this->container['code'] = $code;
+
+ return $this;
+ }
+
+ /**
+ * Gets source
+ *
+ * @return \Bandwidth\Model\BrtcErrorSource|null
+ */
+ public function getSource(): ?\Bandwidth\Model\BrtcErrorSource
+ {
+ return $this->container['source'];
+ }
+
+ /**
+ * Sets source
+ *
+ * @param \Bandwidth\Model\BrtcErrorSource|null $source source
+ *
+ * @return $this
+ */
+ public function setSource(?\Bandwidth\Model\BrtcErrorSource $source): static
+ {
+ if (is_null($source)) {
+ throw new InvalidArgumentException('non-nullable source cannot be null');
+ }
+ $this->container['source'] = $source;
+
+ 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/BrtcErrorResponse.php b/src/Model/BrtcErrorResponse.php
new file mode 100644
index 0000000..34ac11b
--- /dev/null
+++ b/src/Model/BrtcErrorResponse.php
@@ -0,0 +1,468 @@
+
+ */
+class BrtcErrorResponse implements ModelInterface, ArrayAccess, JsonSerializable
+{
+ public const DISCRIMINATOR = null;
+
+ /**
+ * The original name of the model.
+ *
+ * @var string
+ */
+ protected static string $openAPIModelName = 'brtcErrorResponse';
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @var array
+ */
+ protected static array $openAPITypes = [
+ 'links' => '\Bandwidth\Model\BrtcLink[]',
+ 'data' => 'object',
+ 'errors' => '\Bandwidth\Model\BrtcError[]'
+ ];
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @var array
+ */
+ protected static array $openAPIFormats = [
+ 'links' => null,
+ 'data' => null,
+ 'errors' => null
+ ];
+
+ /**
+ * Array of nullable properties. Used for (de)serialization
+ *
+ * @var array
+ */
+ protected static array $openAPINullables = [
+ 'links' => false,
+ 'data' => true,
+ 'errors' => false
+ ];
+
+ /**
+ * 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 = [
+ 'links' => 'links',
+ 'data' => 'data',
+ 'errors' => 'errors'
+ ];
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @var array
+ */
+ protected static array $setters = [
+ 'links' => 'setLinks',
+ 'data' => 'setData',
+ 'errors' => 'setErrors'
+ ];
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @var array
+ */
+ protected static array $getters = [
+ 'links' => 'getLinks',
+ 'data' => 'getData',
+ 'errors' => 'getErrors'
+ ];
+
+ /**
+ * {@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('links', $data ?? [], null);
+ $this->setIfExists('data', $data ?? [], null);
+ $this->setIfExists('errors', $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['links'] === null) {
+ $invalidProperties[] = "'links' can't be null";
+ }
+ if ($this->container['data'] === null && !$this->isNullableSetToNull('data')) {
+ $invalidProperties[] = "'data' is required";
+ }
+ if ($this->container['errors'] === null) {
+ $invalidProperties[] = "'errors' can't be null";
+ }
+ return $invalidProperties;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function valid(): bool
+ {
+ return count($this->listInvalidProperties()) === 0;
+ }
+
+
+ /**
+ * Gets links
+ *
+ * @return \Bandwidth\Model\BrtcLink[]
+ */
+ public function getLinks(): array
+ {
+ return $this->container['links'];
+ }
+
+ /**
+ * Sets links
+ *
+ * @param \Bandwidth\Model\BrtcLink[] $links links
+ *
+ * @return $this
+ */
+ public function setLinks(array $links): static
+ {
+ if (is_null($links)) {
+ throw new InvalidArgumentException('non-nullable links cannot be null');
+ }
+ $this->container['links'] = $links;
+
+ return $this;
+ }
+
+ /**
+ * Gets data
+ *
+ * @return object|null
+ */
+ public function getData(): ?object
+ {
+ return $this->container['data'];
+ }
+
+ /**
+ * Sets data
+ *
+ * @param object|null $data data
+ *
+ * @return $this
+ */
+ public function setData(?object $data): static
+ {
+ if (is_null($data)) {
+ array_push($this->openAPINullablesSetToNull, 'data');
+ } else {
+ $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+ $index = array_search('data', $nullablesSetToNull);
+ if ($index !== FALSE) {
+ unset($nullablesSetToNull[$index]);
+ $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+ }
+ }
+ $this->container['data'] = $data;
+
+ return $this;
+ }
+
+ /**
+ * Gets errors
+ *
+ * @return \Bandwidth\Model\BrtcError[]
+ */
+ public function getErrors(): array
+ {
+ return $this->container['errors'];
+ }
+
+ /**
+ * Sets errors
+ *
+ * @param \Bandwidth\Model\BrtcError[] $errors errors
+ *
+ * @return $this
+ */
+ public function setErrors(array $errors): static
+ {
+ if (is_null($errors)) {
+ throw new InvalidArgumentException('non-nullable errors cannot be null');
+ }
+ $this->container['errors'] = $errors;
+
+ 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/BrtcErrorSource.php b/src/Model/BrtcErrorSource.php
new file mode 100644
index 0000000..4398ef9
--- /dev/null
+++ b/src/Model/BrtcErrorSource.php
@@ -0,0 +1,486 @@
+
+ */
+class BrtcErrorSource implements ModelInterface, ArrayAccess, JsonSerializable
+{
+ public const DISCRIMINATOR = null;
+
+ /**
+ * The original name of the model.
+ *
+ * @var string
+ */
+ protected static string $openAPIModelName = 'brtcErrorSource';
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @var array
+ */
+ protected static array $openAPITypes = [
+ 'parameter' => 'string',
+ 'field' => 'string',
+ 'header' => 'string',
+ 'reference' => 'string'
+ ];
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @var array
+ */
+ protected static array $openAPIFormats = [
+ 'parameter' => null,
+ 'field' => null,
+ 'header' => null,
+ 'reference' => null
+ ];
+
+ /**
+ * Array of nullable properties. Used for (de)serialization
+ *
+ * @var array
+ */
+ protected static array $openAPINullables = [
+ 'parameter' => false,
+ 'field' => false,
+ 'header' => false,
+ 'reference' => false
+ ];
+
+ /**
+ * 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 = [
+ 'parameter' => 'parameter',
+ 'field' => 'field',
+ 'header' => 'header',
+ 'reference' => 'reference'
+ ];
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @var array
+ */
+ protected static array $setters = [
+ 'parameter' => 'setParameter',
+ 'field' => 'setField',
+ 'header' => 'setHeader',
+ 'reference' => 'setReference'
+ ];
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @var array
+ */
+ protected static array $getters = [
+ 'parameter' => 'getParameter',
+ 'field' => 'getField',
+ 'header' => 'getHeader',
+ 'reference' => 'getReference'
+ ];
+
+ /**
+ * {@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('parameter', $data ?? [], null);
+ $this->setIfExists('field', $data ?? [], null);
+ $this->setIfExists('header', $data ?? [], null);
+ $this->setIfExists('reference', $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 = [];
+
+ return $invalidProperties;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function valid(): bool
+ {
+ return count($this->listInvalidProperties()) === 0;
+ }
+
+
+ /**
+ * Gets parameter
+ *
+ * @return string|null
+ */
+ public function getParameter(): ?string
+ {
+ return $this->container['parameter'];
+ }
+
+ /**
+ * Sets parameter
+ *
+ * @param string|null $parameter The URI parameter that caused the error.
+ *
+ * @return $this
+ */
+ public function setParameter(?string $parameter): static
+ {
+ if (is_null($parameter)) {
+ throw new InvalidArgumentException('non-nullable parameter cannot be null');
+ }
+ $this->container['parameter'] = $parameter;
+
+ return $this;
+ }
+
+ /**
+ * Gets field
+ *
+ * @return string|null
+ */
+ public function getField(): ?string
+ {
+ return $this->container['field'];
+ }
+
+ /**
+ * Sets field
+ *
+ * @param string|null $field The request body field that caused the error.
+ *
+ * @return $this
+ */
+ public function setField(?string $field): static
+ {
+ if (is_null($field)) {
+ throw new InvalidArgumentException('non-nullable field cannot be null');
+ }
+ $this->container['field'] = $field;
+
+ return $this;
+ }
+
+ /**
+ * Gets header
+ *
+ * @return string|null
+ */
+ public function getHeader(): ?string
+ {
+ return $this->container['header'];
+ }
+
+ /**
+ * Sets header
+ *
+ * @param string|null $header The header that caused the error.
+ *
+ * @return $this
+ */
+ public function setHeader(?string $header): static
+ {
+ if (is_null($header)) {
+ throw new InvalidArgumentException('non-nullable header cannot be null');
+ }
+ $this->container['header'] = $header;
+
+ return $this;
+ }
+
+ /**
+ * Gets reference
+ *
+ * @return string|null
+ */
+ public function getReference(): ?string
+ {
+ return $this->container['reference'];
+ }
+
+ /**
+ * Sets reference
+ *
+ * @param string|null $reference The resource ID or path to the resource (or non-existent resource) causing the error.
+ *
+ * @return $this
+ */
+ public function setReference(?string $reference): static
+ {
+ if (is_null($reference)) {
+ throw new InvalidArgumentException('non-nullable reference cannot be null');
+ }
+ $this->container['reference'] = $reference;
+
+ 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/BrtcLink.php b/src/Model/BrtcLink.php
new file mode 100644
index 0000000..edb329c
--- /dev/null
+++ b/src/Model/BrtcLink.php
@@ -0,0 +1,452 @@
+
+ */
+class BrtcLink implements ModelInterface, ArrayAccess, JsonSerializable
+{
+ public const DISCRIMINATOR = null;
+
+ /**
+ * The original name of the model.
+ *
+ * @var string
+ */
+ protected static string $openAPIModelName = 'brtcLink';
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @var array
+ */
+ protected static array $openAPITypes = [
+ 'href' => 'string',
+ 'rel' => 'string',
+ 'method' => 'string'
+ ];
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @var array
+ */
+ protected static array $openAPIFormats = [
+ 'href' => null,
+ 'rel' => null,
+ 'method' => null
+ ];
+
+ /**
+ * Array of nullable properties. Used for (de)serialization
+ *
+ * @var array
+ */
+ protected static array $openAPINullables = [
+ 'href' => false,
+ 'rel' => false,
+ 'method' => false
+ ];
+
+ /**
+ * 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 = [
+ 'href' => 'href',
+ 'rel' => 'rel',
+ 'method' => 'method'
+ ];
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @var array
+ */
+ protected static array $setters = [
+ 'href' => 'setHref',
+ 'rel' => 'setRel',
+ 'method' => 'setMethod'
+ ];
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @var array
+ */
+ protected static array $getters = [
+ 'href' => 'getHref',
+ 'rel' => 'getRel',
+ 'method' => 'getMethod'
+ ];
+
+ /**
+ * {@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('href', $data ?? [], null);
+ $this->setIfExists('rel', $data ?? [], null);
+ $this->setIfExists('method', $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 = [];
+
+ return $invalidProperties;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function valid(): bool
+ {
+ return count($this->listInvalidProperties()) === 0;
+ }
+
+
+ /**
+ * Gets href
+ *
+ * @return string|null
+ */
+ public function getHref(): ?string
+ {
+ return $this->container['href'];
+ }
+
+ /**
+ * Sets href
+ *
+ * @param string|null $href The full URL of the link.
+ *
+ * @return $this
+ */
+ public function setHref(?string $href): static
+ {
+ if (is_null($href)) {
+ throw new InvalidArgumentException('non-nullable href cannot be null');
+ }
+ $this->container['href'] = $href;
+
+ return $this;
+ }
+
+ /**
+ * Gets rel
+ *
+ * @return string|null
+ */
+ public function getRel(): ?string
+ {
+ return $this->container['rel'];
+ }
+
+ /**
+ * Sets rel
+ *
+ * @param string|null $rel The relationship of the link to the current resource.
+ *
+ * @return $this
+ */
+ public function setRel(?string $rel): static
+ {
+ if (is_null($rel)) {
+ throw new InvalidArgumentException('non-nullable rel cannot be null');
+ }
+ $this->container['rel'] = $rel;
+
+ return $this;
+ }
+
+ /**
+ * Gets method
+ *
+ * @return string|null
+ */
+ public function getMethod(): ?string
+ {
+ return $this->container['method'];
+ }
+
+ /**
+ * Sets method
+ *
+ * @param string|null $method The HTTP method to use when making the request.
+ *
+ * @return $this
+ */
+ public function setMethod(?string $method): static
+ {
+ if (is_null($method)) {
+ throw new InvalidArgumentException('non-nullable method cannot be null');
+ }
+ $this->container['method'] = $method;
+
+ 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/BusinessEntityTypeEnum.php b/src/Model/BusinessEntityTypeEnum.php
new file mode 100644
index 0000000..4ef0d95
--- /dev/null
+++ b/src/Model/BusinessEntityTypeEnum.php
@@ -0,0 +1,52 @@
+
+ */
+class CallRecordingMetadata implements ModelInterface, ArrayAccess, JsonSerializable
+{
+ public const DISCRIMINATOR = null;
+
+ /**
+ * The original name of the model.
+ *
+ * @var string
+ */
+ protected static string $openAPIModelName = 'callRecordingMetadata';
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @var array
+ */
+ protected static array $openAPITypes = [
+ 'application_id' => 'string',
+ 'account_id' => 'string',
+ 'call_id' => 'string',
+ 'parent_call_id' => 'string',
+ 'recording_id' => 'string',
+ 'to' => 'string',
+ 'from' => 'string',
+ 'transfer_caller_id' => 'string',
+ 'transfer_to' => 'string',
+ 'duration' => 'string',
+ 'direction' => '\Bandwidth\Model\CallDirectionEnum',
+ 'channels' => 'int',
+ 'start_time' => '\DateTime',
+ 'end_time' => '\DateTime',
+ 'file_format' => '\Bandwidth\Model\FileFormatEnum',
+ 'status' => 'string',
+ 'media_url' => 'string',
+ 'transcription' => '\Bandwidth\Model\RecordingTranscriptionMetadata',
+ 'recording_name' => 'string'
+ ];
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @var array
+ */
+ protected static array $openAPIFormats = [
+ 'application_id' => null,
+ 'account_id' => null,
+ 'call_id' => null,
+ 'parent_call_id' => null,
+ 'recording_id' => null,
+ 'to' => null,
+ 'from' => null,
+ 'transfer_caller_id' => null,
+ 'transfer_to' => null,
+ 'duration' => null,
+ 'direction' => null,
+ 'channels' => 'int32',
+ 'start_time' => 'date-time',
+ 'end_time' => 'date-time',
+ 'file_format' => null,
+ 'status' => null,
+ 'media_url' => 'uri',
+ 'transcription' => null,
+ 'recording_name' => null
+ ];
+
+ /**
+ * Array of nullable properties. Used for (de)serialization
+ *
+ * @var array
+ */
+ protected static array $openAPINullables = [
+ 'application_id' => false,
+ 'account_id' => false,
+ 'call_id' => false,
+ 'parent_call_id' => false,
+ 'recording_id' => false,
+ 'to' => false,
+ 'from' => false,
+ 'transfer_caller_id' => false,
+ 'transfer_to' => false,
+ 'duration' => false,
+ 'direction' => false,
+ 'channels' => false,
+ 'start_time' => false,
+ 'end_time' => false,
+ 'file_format' => false,
+ 'status' => false,
+ 'media_url' => true,
+ 'transcription' => true,
+ 'recording_name' => false
+ ];
+
+ /**
+ * 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 = [
+ 'application_id' => 'applicationId',
+ 'account_id' => 'accountId',
+ 'call_id' => 'callId',
+ 'parent_call_id' => 'parentCallId',
+ 'recording_id' => 'recordingId',
+ 'to' => 'to',
+ 'from' => 'from',
+ 'transfer_caller_id' => 'transferCallerId',
+ 'transfer_to' => 'transferTo',
+ 'duration' => 'duration',
+ 'direction' => 'direction',
+ 'channels' => 'channels',
+ 'start_time' => 'startTime',
+ 'end_time' => 'endTime',
+ 'file_format' => 'fileFormat',
+ 'status' => 'status',
+ 'media_url' => 'mediaUrl',
+ 'transcription' => 'transcription',
+ 'recording_name' => 'recordingName'
+ ];
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @var array
+ */
+ protected static array $setters = [
+ 'application_id' => 'setApplicationId',
+ 'account_id' => 'setAccountId',
+ 'call_id' => 'setCallId',
+ 'parent_call_id' => 'setParentCallId',
+ 'recording_id' => 'setRecordingId',
+ 'to' => 'setTo',
+ 'from' => 'setFrom',
+ 'transfer_caller_id' => 'setTransferCallerId',
+ 'transfer_to' => 'setTransferTo',
+ 'duration' => 'setDuration',
+ 'direction' => 'setDirection',
+ 'channels' => 'setChannels',
+ 'start_time' => 'setStartTime',
+ 'end_time' => 'setEndTime',
+ 'file_format' => 'setFileFormat',
+ 'status' => 'setStatus',
+ 'media_url' => 'setMediaUrl',
+ 'transcription' => 'setTranscription',
+ 'recording_name' => 'setRecordingName'
+ ];
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @var array
+ */
+ protected static array $getters = [
+ 'application_id' => 'getApplicationId',
+ 'account_id' => 'getAccountId',
+ 'call_id' => 'getCallId',
+ 'parent_call_id' => 'getParentCallId',
+ 'recording_id' => 'getRecordingId',
+ 'to' => 'getTo',
+ 'from' => 'getFrom',
+ 'transfer_caller_id' => 'getTransferCallerId',
+ 'transfer_to' => 'getTransferTo',
+ 'duration' => 'getDuration',
+ 'direction' => 'getDirection',
+ 'channels' => 'getChannels',
+ 'start_time' => 'getStartTime',
+ 'end_time' => 'getEndTime',
+ 'file_format' => 'getFileFormat',
+ 'status' => 'getStatus',
+ 'media_url' => 'getMediaUrl',
+ 'transcription' => 'getTranscription',
+ 'recording_name' => 'getRecordingName'
+ ];
+
+ /**
+ * {@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('application_id', $data ?? [], null);
+ $this->setIfExists('account_id', $data ?? [], null);
+ $this->setIfExists('call_id', $data ?? [], null);
+ $this->setIfExists('parent_call_id', $data ?? [], null);
+ $this->setIfExists('recording_id', $data ?? [], null);
+ $this->setIfExists('to', $data ?? [], null);
+ $this->setIfExists('from', $data ?? [], null);
+ $this->setIfExists('transfer_caller_id', $data ?? [], null);
+ $this->setIfExists('transfer_to', $data ?? [], null);
+ $this->setIfExists('duration', $data ?? [], null);
+ $this->setIfExists('direction', $data ?? [], null);
+ $this->setIfExists('channels', $data ?? [], null);
+ $this->setIfExists('start_time', $data ?? [], null);
+ $this->setIfExists('end_time', $data ?? [], null);
+ $this->setIfExists('file_format', $data ?? [], null);
+ $this->setIfExists('status', $data ?? [], null);
+ $this->setIfExists('media_url', $data ?? [], null);
+ $this->setIfExists('transcription', $data ?? [], null);
+ $this->setIfExists('recording_name', $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 = [];
+
+ return $invalidProperties;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function valid(): bool
+ {
+ return count($this->listInvalidProperties()) === 0;
+ }
+
+
+ /**
+ * Gets application_id
+ *
+ * @return string|null
+ */
+ public function getApplicationId(): ?string
+ {
+ return $this->container['application_id'];
+ }
+
+ /**
+ * Sets application_id
+ *
+ * @param string|null $application_id The id of the application associated with the call.
+ *
+ * @return $this
+ */
+ public function setApplicationId(?string $application_id): static
+ {
+ if (is_null($application_id)) {
+ throw new InvalidArgumentException('non-nullable application_id cannot be null');
+ }
+ $this->container['application_id'] = $application_id;
+
+ return $this;
+ }
+
+ /**
+ * Gets account_id
+ *
+ * @return string|null
+ */
+ public function getAccountId(): ?string
+ {
+ return $this->container['account_id'];
+ }
+
+ /**
+ * Sets account_id
+ *
+ * @param string|null $account_id The user account associated with the call.
+ *
+ * @return $this
+ */
+ public function setAccountId(?string $account_id): static
+ {
+ if (is_null($account_id)) {
+ throw new InvalidArgumentException('non-nullable account_id cannot be null');
+ }
+ $this->container['account_id'] = $account_id;
+
+ return $this;
+ }
+
+ /**
+ * Gets call_id
+ *
+ * @return string|null
+ */
+ public function getCallId(): ?string
+ {
+ return $this->container['call_id'];
+ }
+
+ /**
+ * Sets call_id
+ *
+ * @param string|null $call_id The call id associated with the event.
+ *
+ * @return $this
+ */
+ public function setCallId(?string $call_id): static
+ {
+ if (is_null($call_id)) {
+ throw new InvalidArgumentException('non-nullable call_id cannot be null');
+ }
+ $this->container['call_id'] = $call_id;
+
+ return $this;
+ }
+
+ /**
+ * Gets parent_call_id
+ *
+ * @return string|null
+ */
+ public function getParentCallId(): ?string
+ {
+ return $this->container['parent_call_id'];
+ }
+
+ /**
+ * Sets parent_call_id
+ *
+ * @param string|null $parent_call_id (optional) If the event is related to the B leg of a , the call id of the original call leg that executed the . Otherwise, this field will not be present.
+ *
+ * @return $this
+ */
+ public function setParentCallId(?string $parent_call_id): static
+ {
+ if (is_null($parent_call_id)) {
+ throw new InvalidArgumentException('non-nullable parent_call_id cannot be null');
+ }
+ $this->container['parent_call_id'] = $parent_call_id;
+
+ return $this;
+ }
+
+ /**
+ * Gets recording_id
+ *
+ * @return string|null
+ */
+ public function getRecordingId(): ?string
+ {
+ return $this->container['recording_id'];
+ }
+
+ /**
+ * Sets recording_id
+ *
+ * @param string|null $recording_id The unique ID of this recording
+ *
+ * @return $this
+ */
+ public function setRecordingId(?string $recording_id): static
+ {
+ if (is_null($recording_id)) {
+ throw new InvalidArgumentException('non-nullable recording_id cannot be null');
+ }
+ $this->container['recording_id'] = $recording_id;
+
+ return $this;
+ }
+
+ /**
+ * Gets to
+ *
+ * @return string|null
+ */
+ public function getTo(): ?string
+ {
+ return $this->container['to'];
+ }
+
+ /**
+ * Sets to
+ *
+ * @param string|null $to The phone number that received the call, in E.164 format (e.g. +15555555555).
+ *
+ * @return $this
+ */
+ public function setTo(?string $to): static
+ {
+ if (is_null($to)) {
+ throw new InvalidArgumentException('non-nullable to cannot be null');
+ }
+ $this->container['to'] = $to;
+
+ return $this;
+ }
+
+ /**
+ * Gets from
+ *
+ * @return string|null
+ */
+ public function getFrom(): ?string
+ {
+ return $this->container['from'];
+ }
+
+ /**
+ * Sets from
+ *
+ * @param string|null $from The provided identifier of the caller. Must be a phone number in E.164 format (e.g. +15555555555).
+ *
+ * @return $this
+ */
+ public function setFrom(?string $from): static
+ {
+ if (is_null($from)) {
+ throw new InvalidArgumentException('non-nullable from cannot be null');
+ }
+ $this->container['from'] = $from;
+
+ return $this;
+ }
+
+ /**
+ * Gets transfer_caller_id
+ *
+ * @return string|null
+ */
+ public function getTransferCallerId(): ?string
+ {
+ return $this->container['transfer_caller_id'];
+ }
+
+ /**
+ * Sets transfer_caller_id
+ *
+ * @param string|null $transfer_caller_id The phone number used as the from field of the B-leg call, in E.164 format (e.g. +15555555555).
+ *
+ * @return $this
+ */
+ public function setTransferCallerId(?string $transfer_caller_id): static
+ {
+ if (is_null($transfer_caller_id)) {
+ throw new InvalidArgumentException('non-nullable transfer_caller_id cannot be null');
+ }
+ $this->container['transfer_caller_id'] = $transfer_caller_id;
+
+ return $this;
+ }
+
+ /**
+ * Gets transfer_to
+ *
+ * @return string|null
+ */
+ public function getTransferTo(): ?string
+ {
+ return $this->container['transfer_to'];
+ }
+
+ /**
+ * Sets transfer_to
+ *
+ * @param string|null $transfer_to The phone number used as the to field of the B-leg call, in E.164 format (e.g. +15555555555).
+ *
+ * @return $this
+ */
+ public function setTransferTo(?string $transfer_to): static
+ {
+ if (is_null($transfer_to)) {
+ throw new InvalidArgumentException('non-nullable transfer_to cannot be null');
+ }
+ $this->container['transfer_to'] = $transfer_to;
+
+ return $this;
+ }
+
+ /**
+ * Gets duration
+ *
+ * @return string|null
+ */
+ public function getDuration(): ?string
+ {
+ return $this->container['duration'];
+ }
+
+ /**
+ * Sets duration
+ *
+ * @param string|null $duration The duration of the recording in ISO-8601 format
+ *
+ * @return $this
+ */
+ public function setDuration(?string $duration): static
+ {
+ if (is_null($duration)) {
+ throw new InvalidArgumentException('non-nullable duration cannot be null');
+ }
+ $this->container['duration'] = $duration;
+
+ return $this;
+ }
+
+ /**
+ * Gets direction
+ *
+ * @return \Bandwidth\Model\CallDirectionEnum|null
+ */
+ public function getDirection(): ?\Bandwidth\Model\CallDirectionEnum
+ {
+ return $this->container['direction'];
+ }
+
+ /**
+ * Sets direction
+ *
+ * @param \Bandwidth\Model\CallDirectionEnum|null $direction direction
+ *
+ * @return $this
+ */
+ public function setDirection(?\Bandwidth\Model\CallDirectionEnum $direction): static
+ {
+ if (is_null($direction)) {
+ throw new InvalidArgumentException('non-nullable direction cannot be null');
+ }
+ $this->container['direction'] = $direction;
+
+ return $this;
+ }
+
+ /**
+ * Gets channels
+ *
+ * @return int|null
+ */
+ public function getChannels(): ?int
+ {
+ return $this->container['channels'];
+ }
+
+ /**
+ * Sets channels
+ *
+ * @param int|null $channels Always `1` for conference recordings; multi-channel recordings are not supported on conferences.
+ *
+ * @return $this
+ */
+ public function setChannels(?int $channels): static
+ {
+ if (is_null($channels)) {
+ throw new InvalidArgumentException('non-nullable channels cannot be null');
+ }
+ $this->container['channels'] = $channels;
+
+ 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 Time the call was started, in ISO 8601 format.
+ *
+ * @return $this
+ */
+ public function setStartTime(?\DateTime $start_time): static
+ {
+ if (is_null($start_time)) {
+ throw new InvalidArgumentException('non-nullable start_time cannot be null');
+ }
+ $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 that the recording ended in ISO-8601 format
+ *
+ * @return $this
+ */
+ public function setEndTime(?\DateTime $end_time): static
+ {
+ if (is_null($end_time)) {
+ throw new InvalidArgumentException('non-nullable end_time cannot be null');
+ }
+ $this->container['end_time'] = $end_time;
+
+ return $this;
+ }
+
+ /**
+ * Gets file_format
+ *
+ * @return \Bandwidth\Model\FileFormatEnum|null
+ */
+ public function getFileFormat(): ?\Bandwidth\Model\FileFormatEnum
+ {
+ return $this->container['file_format'];
+ }
+
+ /**
+ * Sets file_format
+ *
+ * @param \Bandwidth\Model\FileFormatEnum|null $file_format file_format
+ *
+ * @return $this
+ */
+ public function setFileFormat(?\Bandwidth\Model\FileFormatEnum $file_format): static
+ {
+ if (is_null($file_format)) {
+ throw new InvalidArgumentException('non-nullable file_format cannot be null');
+ }
+ $this->container['file_format'] = $file_format;
+
+ return $this;
+ }
+
+ /**
+ * Gets status
+ *
+ * @return string|null
+ */
+ public function getStatus(): ?string
+ {
+ return $this->container['status'];
+ }
+
+ /**
+ * Sets status
+ *
+ * @param string|null $status The current status of the process. For recording, current possible values are 'processing', 'partial', 'complete', 'deleted', and 'error'. For transcriptions, current possible values are 'none', 'processing', 'available', 'error', 'timeout', 'file-size-too-big', and 'file-size-too-small'. Additional states may be added in the future, so your application must be tolerant of unknown values.
+ *
+ * @return $this
+ */
+ public function setStatus(?string $status): static
+ {
+ if (is_null($status)) {
+ throw new InvalidArgumentException('non-nullable status cannot be null');
+ }
+ $this->container['status'] = $status;
+
+ return $this;
+ }
+
+ /**
+ * Gets media_url
+ *
+ * @return string|null
+ */
+ public function getMediaUrl(): ?string
+ {
+ return $this->container['media_url'];
+ }
+
+ /**
+ * Sets media_url
+ *
+ * @param string|null $media_url The URL that can be used to download the recording. Only present if the recording is finished and may be downloaded.
+ *
+ * @return $this
+ */
+ public function setMediaUrl(?string $media_url): static
+ {
+ if (is_null($media_url)) {
+ array_push($this->openAPINullablesSetToNull, 'media_url');
+ } else {
+ $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+ $index = array_search('media_url', $nullablesSetToNull);
+ if ($index !== FALSE) {
+ unset($nullablesSetToNull[$index]);
+ $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+ }
+ }
+ $this->container['media_url'] = $media_url;
+
+ return $this;
+ }
+
+ /**
+ * Gets transcription
+ *
+ * @return \Bandwidth\Model\RecordingTranscriptionMetadata|null
+ */
+ public function getTranscription(): ?\Bandwidth\Model\RecordingTranscriptionMetadata
+ {
+ return $this->container['transcription'];
+ }
+
+ /**
+ * Sets transcription
+ *
+ * @param \Bandwidth\Model\RecordingTranscriptionMetadata|null $transcription transcription
+ *
+ * @return $this
+ */
+ public function setTranscription(?\Bandwidth\Model\RecordingTranscriptionMetadata $transcription): static
+ {
+ if (is_null($transcription)) {
+ array_push($this->openAPINullablesSetToNull, 'transcription');
+ } else {
+ $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+ $index = array_search('transcription', $nullablesSetToNull);
+ if ($index !== FALSE) {
+ unset($nullablesSetToNull[$index]);
+ $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+ }
+ }
+ $this->container['transcription'] = $transcription;
+
+ return $this;
+ }
+
+ /**
+ * Gets recording_name
+ *
+ * @return string|null
+ */
+ public function getRecordingName(): ?string
+ {
+ return $this->container['recording_name'];
+ }
+
+ /**
+ * Sets recording_name
+ *
+ * @param string|null $recording_name A name to identify this recording.
+ *
+ * @return $this
+ */
+ public function setRecordingName(?string $recording_name): static
+ {
+ if (is_null($recording_name)) {
+ throw new InvalidArgumentException('non-nullable recording_name cannot be null');
+ }
+ $this->container['recording_name'] = $recording_name;
+
+ 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/CallState.php b/src/Model/CallState.php
new file mode 100644
index 0000000..e7881a9
--- /dev/null
+++ b/src/Model/CallState.php
@@ -0,0 +1,1032 @@
+
+ */
+class CallState implements ModelInterface, ArrayAccess, JsonSerializable
+{
+ public const DISCRIMINATOR = null;
+
+ /**
+ * The original name of the model.
+ *
+ * @var string
+ */
+ protected static string $openAPIModelName = 'callState';
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @var array
+ */
+ protected static array $openAPITypes = [
+ 'application_id' => 'string',
+ 'account_id' => 'string',
+ 'call_id' => 'string',
+ 'parent_call_id' => 'string',
+ 'to' => 'string',
+ 'from' => 'string',
+ 'direction' => '\Bandwidth\Model\CallDirectionEnum',
+ 'state' => 'string',
+ 'stir_shaken' => 'array',
+ 'identity' => 'string',
+ 'enqueued_time' => '\DateTime',
+ 'start_time' => '\DateTime',
+ 'answer_time' => '\DateTime',
+ 'end_time' => '\DateTime',
+ 'disconnect_cause' => 'string',
+ 'error_message' => 'string',
+ 'error_id' => 'string',
+ 'last_update' => '\DateTime'
+ ];
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @var array
+ */
+ protected static array $openAPIFormats = [
+ 'application_id' => null,
+ 'account_id' => null,
+ 'call_id' => null,
+ 'parent_call_id' => null,
+ 'to' => null,
+ 'from' => null,
+ 'direction' => null,
+ 'state' => null,
+ 'stir_shaken' => null,
+ 'identity' => null,
+ 'enqueued_time' => 'date-time',
+ 'start_time' => 'date-time',
+ 'answer_time' => 'date-time',
+ 'end_time' => 'date-time',
+ 'disconnect_cause' => null,
+ 'error_message' => null,
+ 'error_id' => null,
+ 'last_update' => 'date-time'
+ ];
+
+ /**
+ * Array of nullable properties. Used for (de)serialization
+ *
+ * @var array
+ */
+ protected static array $openAPINullables = [
+ 'application_id' => false,
+ 'account_id' => false,
+ 'call_id' => false,
+ 'parent_call_id' => true,
+ 'to' => false,
+ 'from' => false,
+ 'direction' => false,
+ 'state' => false,
+ 'stir_shaken' => true,
+ 'identity' => true,
+ 'enqueued_time' => true,
+ 'start_time' => true,
+ 'answer_time' => true,
+ 'end_time' => true,
+ 'disconnect_cause' => true,
+ 'error_message' => true,
+ 'error_id' => true,
+ 'last_update' => false
+ ];
+
+ /**
+ * 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 = [
+ 'application_id' => 'applicationId',
+ 'account_id' => 'accountId',
+ 'call_id' => 'callId',
+ 'parent_call_id' => 'parentCallId',
+ 'to' => 'to',
+ 'from' => 'from',
+ 'direction' => 'direction',
+ 'state' => 'state',
+ 'stir_shaken' => 'stirShaken',
+ 'identity' => 'identity',
+ 'enqueued_time' => 'enqueuedTime',
+ 'start_time' => 'startTime',
+ 'answer_time' => 'answerTime',
+ 'end_time' => 'endTime',
+ 'disconnect_cause' => 'disconnectCause',
+ 'error_message' => 'errorMessage',
+ 'error_id' => 'errorId',
+ 'last_update' => 'lastUpdate'
+ ];
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @var array
+ */
+ protected static array $setters = [
+ 'application_id' => 'setApplicationId',
+ 'account_id' => 'setAccountId',
+ 'call_id' => 'setCallId',
+ 'parent_call_id' => 'setParentCallId',
+ 'to' => 'setTo',
+ 'from' => 'setFrom',
+ 'direction' => 'setDirection',
+ 'state' => 'setState',
+ 'stir_shaken' => 'setStirShaken',
+ 'identity' => 'setIdentity',
+ 'enqueued_time' => 'setEnqueuedTime',
+ 'start_time' => 'setStartTime',
+ 'answer_time' => 'setAnswerTime',
+ 'end_time' => 'setEndTime',
+ 'disconnect_cause' => 'setDisconnectCause',
+ 'error_message' => 'setErrorMessage',
+ 'error_id' => 'setErrorId',
+ 'last_update' => 'setLastUpdate'
+ ];
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @var array
+ */
+ protected static array $getters = [
+ 'application_id' => 'getApplicationId',
+ 'account_id' => 'getAccountId',
+ 'call_id' => 'getCallId',
+ 'parent_call_id' => 'getParentCallId',
+ 'to' => 'getTo',
+ 'from' => 'getFrom',
+ 'direction' => 'getDirection',
+ 'state' => 'getState',
+ 'stir_shaken' => 'getStirShaken',
+ 'identity' => 'getIdentity',
+ 'enqueued_time' => 'getEnqueuedTime',
+ 'start_time' => 'getStartTime',
+ 'answer_time' => 'getAnswerTime',
+ 'end_time' => 'getEndTime',
+ 'disconnect_cause' => 'getDisconnectCause',
+ 'error_message' => 'getErrorMessage',
+ 'error_id' => 'getErrorId',
+ 'last_update' => 'getLastUpdate'
+ ];
+
+ /**
+ * {@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('application_id', $data ?? [], null);
+ $this->setIfExists('account_id', $data ?? [], null);
+ $this->setIfExists('call_id', $data ?? [], null);
+ $this->setIfExists('parent_call_id', $data ?? [], null);
+ $this->setIfExists('to', $data ?? [], null);
+ $this->setIfExists('from', $data ?? [], null);
+ $this->setIfExists('direction', $data ?? [], null);
+ $this->setIfExists('state', $data ?? [], null);
+ $this->setIfExists('stir_shaken', $data ?? [], null);
+ $this->setIfExists('identity', $data ?? [], null);
+ $this->setIfExists('enqueued_time', $data ?? [], null);
+ $this->setIfExists('start_time', $data ?? [], null);
+ $this->setIfExists('answer_time', $data ?? [], null);
+ $this->setIfExists('end_time', $data ?? [], null);
+ $this->setIfExists('disconnect_cause', $data ?? [], null);
+ $this->setIfExists('error_message', $data ?? [], null);
+ $this->setIfExists('error_id', $data ?? [], null);
+ $this->setIfExists('last_update', $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 = [];
+
+ return $invalidProperties;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function valid(): bool
+ {
+ return count($this->listInvalidProperties()) === 0;
+ }
+
+
+ /**
+ * Gets application_id
+ *
+ * @return string|null
+ */
+ public function getApplicationId(): ?string
+ {
+ return $this->container['application_id'];
+ }
+
+ /**
+ * Sets application_id
+ *
+ * @param string|null $application_id The application id associated with the call.
+ *
+ * @return $this
+ */
+ public function setApplicationId(?string $application_id): static
+ {
+ if (is_null($application_id)) {
+ throw new InvalidArgumentException('non-nullable application_id cannot be null');
+ }
+ $this->container['application_id'] = $application_id;
+
+ return $this;
+ }
+
+ /**
+ * Gets account_id
+ *
+ * @return string|null
+ */
+ public function getAccountId(): ?string
+ {
+ return $this->container['account_id'];
+ }
+
+ /**
+ * Sets account_id
+ *
+ * @param string|null $account_id The account id associated with the call.
+ *
+ * @return $this
+ */
+ public function setAccountId(?string $account_id): static
+ {
+ if (is_null($account_id)) {
+ throw new InvalidArgumentException('non-nullable account_id cannot be null');
+ }
+ $this->container['account_id'] = $account_id;
+
+ return $this;
+ }
+
+ /**
+ * Gets call_id
+ *
+ * @return string|null
+ */
+ public function getCallId(): ?string
+ {
+ return $this->container['call_id'];
+ }
+
+ /**
+ * Sets call_id
+ *
+ * @param string|null $call_id The programmable voice API call ID.
+ *
+ * @return $this
+ */
+ public function setCallId(?string $call_id): static
+ {
+ if (is_null($call_id)) {
+ throw new InvalidArgumentException('non-nullable call_id cannot be null');
+ }
+ $this->container['call_id'] = $call_id;
+
+ return $this;
+ }
+
+ /**
+ * Gets parent_call_id
+ *
+ * @return string|null
+ */
+ public function getParentCallId(): ?string
+ {
+ return $this->container['parent_call_id'];
+ }
+
+ /**
+ * Sets parent_call_id
+ *
+ * @param string|null $parent_call_id The A-leg call id, set only if this call is the B-leg of a [``](/docs/voice/bxml/transfer).
+ *
+ * @return $this
+ */
+ public function setParentCallId(?string $parent_call_id): static
+ {
+ if (is_null($parent_call_id)) {
+ array_push($this->openAPINullablesSetToNull, 'parent_call_id');
+ } else {
+ $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+ $index = array_search('parent_call_id', $nullablesSetToNull);
+ if ($index !== FALSE) {
+ unset($nullablesSetToNull[$index]);
+ $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+ }
+ }
+ $this->container['parent_call_id'] = $parent_call_id;
+
+ return $this;
+ }
+
+ /**
+ * Gets to
+ *
+ * @return string|null
+ */
+ public function getTo(): ?string
+ {
+ return $this->container['to'];
+ }
+
+ /**
+ * Sets to
+ *
+ * @param string|null $to The phone number that received the call, in E.164 format (e.g. +15555555555), or if the call was to a SIP URI, the SIP URI.
+ *
+ * @return $this
+ */
+ public function setTo(?string $to): static
+ {
+ if (is_null($to)) {
+ throw new InvalidArgumentException('non-nullable to cannot be null');
+ }
+ $this->container['to'] = $to;
+
+ return $this;
+ }
+
+ /**
+ * Gets from
+ *
+ * @return string|null
+ */
+ public function getFrom(): ?string
+ {
+ return $this->container['from'];
+ }
+
+ /**
+ * Sets from
+ *
+ * @param string|null $from The phone number that made the call, in E.164 format (e.g. +15555555555).
+ *
+ * @return $this
+ */
+ public function setFrom(?string $from): static
+ {
+ if (is_null($from)) {
+ throw new InvalidArgumentException('non-nullable from cannot be null');
+ }
+ $this->container['from'] = $from;
+
+ return $this;
+ }
+
+ /**
+ * Gets direction
+ *
+ * @return \Bandwidth\Model\CallDirectionEnum|null
+ */
+ public function getDirection(): ?\Bandwidth\Model\CallDirectionEnum
+ {
+ return $this->container['direction'];
+ }
+
+ /**
+ * Sets direction
+ *
+ * @param \Bandwidth\Model\CallDirectionEnum|null $direction direction
+ *
+ * @return $this
+ */
+ public function setDirection(?\Bandwidth\Model\CallDirectionEnum $direction): static
+ {
+ if (is_null($direction)) {
+ throw new InvalidArgumentException('non-nullable direction cannot be null');
+ }
+ $this->container['direction'] = $direction;
+
+ return $this;
+ }
+
+ /**
+ * Gets state
+ *
+ * @return string|null
+ */
+ public function getState(): ?string
+ {
+ return $this->container['state'];
+ }
+
+ /**
+ * Sets state
+ *
+ * @param string|null $state The current state of the call. Current possible values are `queued`, `initiated`, `answered` and `disconnected`. Additional states may be added in the future, so your application must be tolerant of unknown values.
+ *
+ * @return $this
+ */
+ public function setState(?string $state): static
+ {
+ if (is_null($state)) {
+ throw new InvalidArgumentException('non-nullable state cannot be null');
+ }
+ $this->container['state'] = $state;
+
+ return $this;
+ }
+
+ /**
+ * Gets stir_shaken
+ *
+ * @return array|null
+ */
+ public function getStirShaken(): ?array
+ {
+ return $this->container['stir_shaken'];
+ }
+
+ /**
+ * Sets stir_shaken
+ *
+ * @param array|null $stir_shaken For inbound calls, the Bandwidth STIR/SHAKEN implementation will verify the information provided in the inbound invite request `Identity` header. The verification status is stored in the call state `stirShaken` property as follows. | Property | Description | |:------------------|:------------| | verstat | (optional) The verification status indicating whether the verification was successful or not. Possible values are `TN-Validation-Passed` or `TN-Validation-Failed`. | | attestationIndicator | (optional) The attestation level verified by Bandwidth. Possible values are `A` (full), `B` (partial) or `C` (gateway). | | originatingId | (optional) A unique origination identifier. | Note that these are common properties but that the `stirShaken` object is free form and can contain other key-value pairs. More information: [Understanding STIR/SHAKEN](https://www.bandwidth.com/regulations/stir-shaken).
+ *
+ * @return $this
+ */
+ public function setStirShaken(?array $stir_shaken): static
+ {
+ if (is_null($stir_shaken)) {
+ array_push($this->openAPINullablesSetToNull, 'stir_shaken');
+ } else {
+ $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+ $index = array_search('stir_shaken', $nullablesSetToNull);
+ if ($index !== FALSE) {
+ unset($nullablesSetToNull[$index]);
+ $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+ }
+ }
+ $this->container['stir_shaken'] = $stir_shaken;
+
+ return $this;
+ }
+
+ /**
+ * Gets identity
+ *
+ * @return string|null
+ */
+ public function getIdentity(): ?string
+ {
+ return $this->container['identity'];
+ }
+
+ /**
+ * Sets identity
+ *
+ * @param string|null $identity The value of the `Identity` header from the inbound invite request. Only present for inbound calls and if the account is configured to forward this header.
+ *
+ * @return $this
+ */
+ public function setIdentity(?string $identity): static
+ {
+ if (is_null($identity)) {
+ array_push($this->openAPINullablesSetToNull, 'identity');
+ } else {
+ $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+ $index = array_search('identity', $nullablesSetToNull);
+ if ($index !== FALSE) {
+ unset($nullablesSetToNull[$index]);
+ $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+ }
+ }
+ $this->container['identity'] = $identity;
+
+ return $this;
+ }
+
+ /**
+ * Gets enqueued_time
+ *
+ * @return \DateTime|null
+ */
+ public function getEnqueuedTime(): ?\DateTime
+ {
+ return $this->container['enqueued_time'];
+ }
+
+ /**
+ * Sets enqueued_time
+ *
+ * @param \DateTime|null $enqueued_time The time this call was placed in queue.
+ *
+ * @return $this
+ */
+ public function setEnqueuedTime(?\DateTime $enqueued_time): static
+ {
+ if (is_null($enqueued_time)) {
+ array_push($this->openAPINullablesSetToNull, 'enqueued_time');
+ } else {
+ $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+ $index = array_search('enqueued_time', $nullablesSetToNull);
+ if ($index !== FALSE) {
+ unset($nullablesSetToNull[$index]);
+ $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+ }
+ }
+ $this->container['enqueued_time'] = $enqueued_time;
+
+ 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 call was initiated, in ISO 8601 format. `null` if the call is still in your queue.
+ *
+ * @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 answer_time
+ *
+ * @return \DateTime|null
+ */
+ public function getAnswerTime(): ?\DateTime
+ {
+ return $this->container['answer_time'];
+ }
+
+ /**
+ * Sets answer_time
+ *
+ * @param \DateTime|null $answer_time Populated once the call has been answered, with the time in ISO 8601 format.
+ *
+ * @return $this
+ */
+ public function setAnswerTime(?\DateTime $answer_time): static
+ {
+ if (is_null($answer_time)) {
+ array_push($this->openAPINullablesSetToNull, 'answer_time');
+ } else {
+ $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+ $index = array_search('answer_time', $nullablesSetToNull);
+ if ($index !== FALSE) {
+ unset($nullablesSetToNull[$index]);
+ $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+ }
+ }
+ $this->container['answer_time'] = $answer_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 Populated once the call has ended, with the time in ISO 8601 format.
+ *
+ * @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;
+ }
+
+ /**
+ * Gets disconnect_cause
+ *
+ * @return string|null
+ */
+ public function getDisconnectCause(): ?string
+ {
+ return $this->container['disconnect_cause'];
+ }
+
+ /**
+ * Sets disconnect_cause
+ *
+ * @param string|null $disconnect_cause | Cause | Description | |:------|:------------| | `hangup`| One party hung up the call, a [``](../../bxml/verbs/hangup.md) verb was executed, or there was no more BXML to execute; it indicates that the call ended normally. | | `busy` | Callee was busy. | | `timeout` | Call wasn't answered before the `callTimeout` was reached. | | `cancel` | Call was cancelled by its originator while it was ringing. | | `rejected` | Call was rejected by the callee. | | `callback-error` | BXML callback couldn't be delivered to your callback server. | | `invalid-bxml` | Invalid BXML was returned in response to a callback. | | `application-error` | An unsupported action was tried on the call, e.g. trying to play a .ogg audio. | | `account-limit` | Account rate limits were reached. | | `node-capacity-exceeded` | System maximum capacity was reached. | | `error` | Some error not described in any of the other causes happened on the call. | | `unknown` | Unknown error happened on the call. | Note: This list is not exhaustive and other values can appear in the future.
+ *
+ * @return $this
+ */
+ public function setDisconnectCause(?string $disconnect_cause): static
+ {
+ if (is_null($disconnect_cause)) {
+ array_push($this->openAPINullablesSetToNull, 'disconnect_cause');
+ } else {
+ $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+ $index = array_search('disconnect_cause', $nullablesSetToNull);
+ if ($index !== FALSE) {
+ unset($nullablesSetToNull[$index]);
+ $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+ }
+ }
+ $this->container['disconnect_cause'] = $disconnect_cause;
+
+ return $this;
+ }
+
+ /**
+ * Gets error_message
+ *
+ * @return string|null
+ */
+ public function getErrorMessage(): ?string
+ {
+ return $this->container['error_message'];
+ }
+
+ /**
+ * Sets error_message
+ *
+ * @param string|null $error_message Populated only if the call ended with an error, with text explaining the reason.
+ *
+ * @return $this
+ */
+ public function setErrorMessage(?string $error_message): static
+ {
+ if (is_null($error_message)) {
+ array_push($this->openAPINullablesSetToNull, 'error_message');
+ } else {
+ $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+ $index = array_search('error_message', $nullablesSetToNull);
+ if ($index !== FALSE) {
+ unset($nullablesSetToNull[$index]);
+ $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+ }
+ }
+ $this->container['error_message'] = $error_message;
+
+ return $this;
+ }
+
+ /**
+ * Gets error_id
+ *
+ * @return string|null
+ */
+ public function getErrorId(): ?string
+ {
+ return $this->container['error_id'];
+ }
+
+ /**
+ * Sets error_id
+ *
+ * @param string|null $error_id Populated only if the call ended with an error, with a Bandwidth internal id that references the error event.
+ *
+ * @return $this
+ */
+ public function setErrorId(?string $error_id): static
+ {
+ if (is_null($error_id)) {
+ array_push($this->openAPINullablesSetToNull, 'error_id');
+ } else {
+ $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+ $index = array_search('error_id', $nullablesSetToNull);
+ if ($index !== FALSE) {
+ unset($nullablesSetToNull[$index]);
+ $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+ }
+ }
+ $this->container['error_id'] = $error_id;
+
+ return $this;
+ }
+
+ /**
+ * Gets last_update
+ *
+ * @return \DateTime|null
+ */
+ public function getLastUpdate(): ?\DateTime
+ {
+ return $this->container['last_update'];
+ }
+
+ /**
+ * Sets last_update
+ *
+ * @param \DateTime|null $last_update The last time the call had a state update, in ISO 8601 format.
+ *
+ * @return $this
+ */
+ public function setLastUpdate(?\DateTime $last_update): static
+ {
+ if (is_null($last_update)) {
+ throw new InvalidArgumentException('non-nullable last_update cannot be null');
+ }
+ $this->container['last_update'] = $last_update;
+
+ 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/CallStateEnum.php b/src/Model/CallStateEnum.php
new file mode 100644
index 0000000..8213f29
--- /dev/null
+++ b/src/Model/CallStateEnum.php
@@ -0,0 +1,46 @@
+
+ */
+class CallTranscription implements ModelInterface, ArrayAccess, JsonSerializable
+{
+ public const DISCRIMINATOR = null;
+
+ /**
+ * The original name of the model.
+ *
+ * @var string
+ */
+ protected static string $openAPIModelName = 'callTranscription';
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @var array
+ */
+ protected static array $openAPITypes = [
+ 'detected_language' => '\Bandwidth\Model\CallTranscriptionDetectedLanguageEnum',
+ 'track' => '\Bandwidth\Model\CallTranscriptionTrackEnum',
+ 'transcript' => 'string',
+ 'confidence' => 'float'
+ ];
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @var array
+ */
+ protected static array $openAPIFormats = [
+ 'detected_language' => null,
+ 'track' => null,
+ 'transcript' => null,
+ 'confidence' => 'double'
+ ];
+
+ /**
+ * Array of nullable properties. Used for (de)serialization
+ *
+ * @var array
+ */
+ protected static array $openAPINullables = [
+ 'detected_language' => false,
+ 'track' => false,
+ 'transcript' => false,
+ 'confidence' => false
+ ];
+
+ /**
+ * 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 = [
+ 'detected_language' => 'detectedLanguage',
+ 'track' => 'track',
+ 'transcript' => 'transcript',
+ 'confidence' => 'confidence'
+ ];
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @var array
+ */
+ protected static array $setters = [
+ 'detected_language' => 'setDetectedLanguage',
+ 'track' => 'setTrack',
+ 'transcript' => 'setTranscript',
+ 'confidence' => 'setConfidence'
+ ];
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @var array
+ */
+ protected static array $getters = [
+ 'detected_language' => 'getDetectedLanguage',
+ 'track' => 'getTrack',
+ 'transcript' => 'getTranscript',
+ 'confidence' => 'getConfidence'
+ ];
+
+ /**
+ * {@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('detected_language', $data ?? [], null);
+ $this->setIfExists('track', $data ?? [], null);
+ $this->setIfExists('transcript', $data ?? [], null);
+ $this->setIfExists('confidence', $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 (!is_null($this->container['confidence']) && ($this->container['confidence'] > 1)) {
+ $invalidProperties[] = "invalid value for 'confidence', must be smaller than or equal to 1.";
+ }
+
+ if (!is_null($this->container['confidence']) && ($this->container['confidence'] < 0)) {
+ $invalidProperties[] = "invalid value for 'confidence', must be bigger than or equal to 0.";
+ }
+
+ return $invalidProperties;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function valid(): bool
+ {
+ return count($this->listInvalidProperties()) === 0;
+ }
+
+
+ /**
+ * Gets detected_language
+ *
+ * @return \Bandwidth\Model\CallTranscriptionDetectedLanguageEnum|null
+ */
+ public function getDetectedLanguage(): ?\Bandwidth\Model\CallTranscriptionDetectedLanguageEnum
+ {
+ return $this->container['detected_language'];
+ }
+
+ /**
+ * Sets detected_language
+ *
+ * @param \Bandwidth\Model\CallTranscriptionDetectedLanguageEnum|null $detected_language detected_language
+ *
+ * @return $this
+ */
+ public function setDetectedLanguage(?\Bandwidth\Model\CallTranscriptionDetectedLanguageEnum $detected_language): static
+ {
+ if (is_null($detected_language)) {
+ throw new InvalidArgumentException('non-nullable detected_language cannot be null');
+ }
+ $this->container['detected_language'] = $detected_language;
+
+ return $this;
+ }
+
+ /**
+ * Gets track
+ *
+ * @return \Bandwidth\Model\CallTranscriptionTrackEnum|null
+ */
+ public function getTrack(): ?\Bandwidth\Model\CallTranscriptionTrackEnum
+ {
+ return $this->container['track'];
+ }
+
+ /**
+ * Sets track
+ *
+ * @param \Bandwidth\Model\CallTranscriptionTrackEnum|null $track track
+ *
+ * @return $this
+ */
+ public function setTrack(?\Bandwidth\Model\CallTranscriptionTrackEnum $track): static
+ {
+ if (is_null($track)) {
+ throw new InvalidArgumentException('non-nullable track cannot be null');
+ }
+ $this->container['track'] = $track;
+
+ return $this;
+ }
+
+ /**
+ * Gets transcript
+ *
+ * @return string|null
+ */
+ public function getTranscript(): ?string
+ {
+ return $this->container['transcript'];
+ }
+
+ /**
+ * Sets transcript
+ *
+ * @param string|null $transcript The transcription itself.
+ *
+ * @return $this
+ */
+ public function setTranscript(?string $transcript): static
+ {
+ if (is_null($transcript)) {
+ throw new InvalidArgumentException('non-nullable transcript cannot be null');
+ }
+ $this->container['transcript'] = $transcript;
+
+ return $this;
+ }
+
+ /**
+ * Gets confidence
+ *
+ * @return float|null
+ */
+ public function getConfidence(): ?float
+ {
+ return $this->container['confidence'];
+ }
+
+ /**
+ * Sets confidence
+ *
+ * @param float|null $confidence How confident the transcription engine was in transcribing the associated audio (from `0` to `1`).
+ *
+ * @return $this
+ */
+ public function setConfidence(?float $confidence): static
+ {
+ if (is_null($confidence)) {
+ throw new InvalidArgumentException('non-nullable confidence cannot be null');
+ }
+ if (($confidence > 1)) {
+ throw new InvalidArgumentException('invalid value for $confidence when calling CallTranscription., must be smaller than or equal to 1.');
+ }
+ if (($confidence < 0)) {
+ throw new InvalidArgumentException('invalid value for $confidence when calling CallTranscription., must be bigger than or equal to 0.');
+ }
+
+ $this->container['confidence'] = $confidence;
+
+ 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/CallTranscriptionDetectedLanguageEnum.php b/src/Model/CallTranscriptionDetectedLanguageEnum.php
new file mode 100644
index 0000000..d903c3a
--- /dev/null
+++ b/src/Model/CallTranscriptionDetectedLanguageEnum.php
@@ -0,0 +1,48 @@
+
+ */
+class CallTranscriptionMetadata implements ModelInterface, ArrayAccess, JsonSerializable
+{
+ public const DISCRIMINATOR = null;
+
+ /**
+ * The original name of the model.
+ *
+ * @var string
+ */
+ protected static string $openAPIModelName = 'callTranscriptionMetadata';
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @var array
+ */
+ protected static array $openAPITypes = [
+ 'transcription_id' => 'string',
+ 'transcription_name' => 'string',
+ 'transcription_url' => 'string'
+ ];
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @var array
+ */
+ protected static array $openAPIFormats = [
+ 'transcription_id' => null,
+ 'transcription_name' => null,
+ 'transcription_url' => null
+ ];
+
+ /**
+ * Array of nullable properties. Used for (de)serialization
+ *
+ * @var array
+ */
+ protected static array $openAPINullables = [
+ 'transcription_id' => false,
+ 'transcription_name' => false,
+ 'transcription_url' => false
+ ];
+
+ /**
+ * 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 = [
+ 'transcription_id' => 'transcriptionId',
+ 'transcription_name' => 'transcriptionName',
+ 'transcription_url' => 'transcriptionUrl'
+ ];
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @var array
+ */
+ protected static array $setters = [
+ 'transcription_id' => 'setTranscriptionId',
+ 'transcription_name' => 'setTranscriptionName',
+ 'transcription_url' => 'setTranscriptionUrl'
+ ];
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @var array
+ */
+ protected static array $getters = [
+ 'transcription_id' => 'getTranscriptionId',
+ 'transcription_name' => 'getTranscriptionName',
+ 'transcription_url' => 'getTranscriptionUrl'
+ ];
+
+ /**
+ * {@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('transcription_id', $data ?? [], null);
+ $this->setIfExists('transcription_name', $data ?? [], null);
+ $this->setIfExists('transcription_url', $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 = [];
+
+ return $invalidProperties;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function valid(): bool
+ {
+ return count($this->listInvalidProperties()) === 0;
+ }
+
+
+ /**
+ * Gets transcription_id
+ *
+ * @return string|null
+ */
+ public function getTranscriptionId(): ?string
+ {
+ return $this->container['transcription_id'];
+ }
+
+ /**
+ * Sets transcription_id
+ *
+ * @param string|null $transcription_id The programmable voice API transcription ID.
+ *
+ * @return $this
+ */
+ public function setTranscriptionId(?string $transcription_id): static
+ {
+ if (is_null($transcription_id)) {
+ throw new InvalidArgumentException('non-nullable transcription_id cannot be null');
+ }
+ $this->container['transcription_id'] = $transcription_id;
+
+ return $this;
+ }
+
+ /**
+ * Gets transcription_name
+ *
+ * @return string|null
+ */
+ public function getTranscriptionName(): ?string
+ {
+ return $this->container['transcription_name'];
+ }
+
+ /**
+ * Sets transcription_name
+ *
+ * @param string|null $transcription_name The programmable voice API transcription name. This name could be provided by the user when creating the transcription.
+ *
+ * @return $this
+ */
+ public function setTranscriptionName(?string $transcription_name): static
+ {
+ if (is_null($transcription_name)) {
+ throw new InvalidArgumentException('non-nullable transcription_name cannot be null');
+ }
+ $this->container['transcription_name'] = $transcription_name;
+
+ return $this;
+ }
+
+ /**
+ * Gets transcription_url
+ *
+ * @return string|null
+ */
+ public function getTranscriptionUrl(): ?string
+ {
+ return $this->container['transcription_url'];
+ }
+
+ /**
+ * Sets transcription_url
+ *
+ * @param string|null $transcription_url A URL that may be used to retrieve the transcription itself. This points to the [Get Call Transcription](/apis/voice-apis/voice/#tag/Transcriptions/operation/getRealTimeTranscription) endpoint.
+ *
+ * @return $this
+ */
+ public function setTranscriptionUrl(?string $transcription_url): static
+ {
+ if (is_null($transcription_url)) {
+ throw new InvalidArgumentException('non-nullable transcription_url cannot be null');
+ }
+ $this->container['transcription_url'] = $transcription_url;
+
+ 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/CallTranscriptionResponse.php b/src/Model/CallTranscriptionResponse.php
new file mode 100644
index 0000000..324e514
--- /dev/null
+++ b/src/Model/CallTranscriptionResponse.php
@@ -0,0 +1,486 @@
+
+ */
+class CallTranscriptionResponse implements ModelInterface, ArrayAccess, JsonSerializable
+{
+ public const DISCRIMINATOR = null;
+
+ /**
+ * The original name of the model.
+ *
+ * @var string
+ */
+ protected static string $openAPIModelName = 'callTranscriptionResponse';
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @var array
+ */
+ protected static array $openAPITypes = [
+ 'account_id' => 'string',
+ 'call_id' => 'string',
+ 'transcription_id' => 'string',
+ 'tracks' => '\Bandwidth\Model\CallTranscription[]'
+ ];
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @var array
+ */
+ protected static array $openAPIFormats = [
+ 'account_id' => null,
+ 'call_id' => null,
+ 'transcription_id' => null,
+ 'tracks' => null
+ ];
+
+ /**
+ * Array of nullable properties. Used for (de)serialization
+ *
+ * @var array
+ */
+ protected static array $openAPINullables = [
+ 'account_id' => false,
+ 'call_id' => false,
+ 'transcription_id' => false,
+ 'tracks' => false
+ ];
+
+ /**
+ * 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