Skip to content

Commit

Permalink
馃帀Source Twilio: New stream Trunks (#25781)
Browse files Browse the repository at this point in the history
* Add new stream trunks

* fix expected records

* bump mtdt file

* add allowed host and bump metadata version

---------

Co-authored-by: sh4sh <6833405+sh4sh@users.noreply.github.com>
Co-authored-by: marcosmarxm <marcosmarxm@gmail.com>
Co-authored-by: Marcos Marx <marcosmarxm@users.noreply.github.com>
  • Loading branch information
4 people committed May 23, 2023
1 parent fda4a9f commit 53d66be
Show file tree
Hide file tree
Showing 7 changed files with 116 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,15 @@
"sync_mode": "full_refresh",
"destination_sync_mode": "overwrite"
},
{
"stream": {
"name": "trunks",
"json_schema": {},
"supported_sync_modes": ["full_refresh"]
},
"sync_mode": "full_refresh",
"destination_sync_mode": "overwrite"
},
{
"stream": {
"name": "queues",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,5 +61,6 @@
{"stream": "usage_triggers", "data": {"sid": "UTed691d2a56a64c45baa9810c16f5931a", "account_sid": "ACdade166c12e160e9ed0a6088226718fb", "date_created": "2023-02-14T14:34:32Z", "date_updated": "2023-02-14T14:34:32Z", "date_fired": null, "friendly_name": null, "usage_category": "sms", "trigger_by": "usage", "recurring": "", "trigger_value": 1000.0, "current_value": 146.0, "callback_url": "http://www.example.com/", "callback_method": "POST", "usage_record_uri": "/2010-04-01/Accounts/ACdade166c12e160e9ed0a6088226718fb/Usage/Records.json?Category=sms", "uri": "/2010-04-01/Accounts/ACdade166c12e160e9ed0a6088226718fb/Usage/Triggers/UTed691d2a56a64c45baa9810c16f5931a.json", "api_version": "2010-04-01"}, "emitted_at": 1682602977675}
{"stream": "usage_triggers", "data": {"sid": "UT73ded683c9884266befb032487fac75e", "account_sid": "ACdade166c12e160e9ed0a6088226718fb", "date_created": "2023-02-14T14:34:33Z", "date_updated": "2023-02-14T14:34:33Z", "date_fired": null, "friendly_name": null, "usage_category": "sms", "trigger_by": "usage", "recurring": "", "trigger_value": 1000.0, "current_value": 146.0, "callback_url": "http://www.example.com/", "callback_method": "POST", "usage_record_uri": "/2010-04-01/Accounts/ACdade166c12e160e9ed0a6088226718fb/Usage/Records.json?Category=sms", "uri": "/2010-04-01/Accounts/ACdade166c12e160e9ed0a6088226718fb/Usage/Triggers/UT73ded683c9884266befb032487fac75e.json", "api_version": "2010-04-01"}, "emitted_at": 1682602977676}
{"stream": "usage_triggers", "data": {"sid": "UT5b9448b2d4e943539f1bba5f052ef01b", "account_sid": "ACdade166c12e160e9ed0a6088226718fb", "date_created": "2023-02-14T14:34:34Z", "date_updated": "2023-02-14T14:34:34Z", "date_fired": null, "friendly_name": null, "usage_category": "sms", "trigger_by": "usage", "recurring": "", "trigger_value": 1000.0, "current_value": 146.0, "callback_url": "http://www.example.com/", "callback_method": "POST", "usage_record_uri": "/2010-04-01/Accounts/ACdade166c12e160e9ed0a6088226718fb/Usage/Records.json?Category=sms", "uri": "/2010-04-01/Accounts/ACdade166c12e160e9ed0a6088226718fb/Usage/Triggers/UT5b9448b2d4e943539f1bba5f052ef01b.json", "api_version": "2010-04-01"}, "emitted_at": 1682602977678}
{"stream": "trunks", "data": {"auth_type": "", "transfer_mode": "disable-all", "secure": false, "auth_type_set": [], "date_updated": "2023-05-10T17:29:44Z", "friendly_name": "integration-test-trunk", "domain_name": null, "disaster_recovery_url": null, "account_sid": "ACdade166c12e160e9ed0a6088226718fb", "recording": {"trim": "do-not-trim", "mode": "do-not-record"}, "transfer_caller_id": "from-transferee", "disaster_recovery_method": null, "url": "https://trunking.twilio.com/v1/Trunks/TKdd4b0b21323f45ad4ce9164761d18237", "sid": "TKdd4b0b21323f45ad4ce9164761d18237", "date_created": "2023-05-10T17:27:17Z", "cnam_lookup_enabled": false, "links": {"phone_numbers": "https://trunking.twilio.com/v1/Trunks/TKdd4b0b21323f45ad4ce9164761d18237/PhoneNumbers", "ip_access_control_lists": "https://trunking.twilio.com/v1/Trunks/TKdd4b0b21323f45ad4ce9164761d18237/IpAccessControlLists", "origination_urls": "https://trunking.twilio.com/v1/Trunks/TKdd4b0b21323f45ad4ce9164761d18237/OriginationUrls", "credential_lists": "https://trunking.twilio.com/v1/Trunks/TKdd4b0b21323f45ad4ce9164761d18237/CredentialLists"}}, "emitted_at": 1684432326862}
{"stream": "roles", "data": {"date_updated": "2023-03-21T13:35:15Z", "friendly_name": "service user", "account_sid": "ACdade166c12e160e9ed0a6088226718fb", "url": "https://chat.twilio.com/v2/Services/IS5fcc074f7ead44c99a0a24a374a7e19f/Roles/RL1c0ab592f9724a10992c2ea29709f6cd", "sid": "RL1c0ab592f9724a10992c2ea29709f6cd", "date_created": "2023-03-21T13:35:15Z", "service_sid": "IS5fcc074f7ead44c99a0a24a374a7e19f", "type": "deployment", "permissions": ["createChannel", "joinChannel", "editOwnUserInfo"]}, "emitted_at": 1684513502733}
{"stream": "services", "data": {"typing_indicator_timeout": 5.0, "date_updated": "2023-03-21T13:35:15Z", "post_webhook_url": null, "read_status_enabled": true, "consumption_report_interval": 10.0, "pre_webhook_retry_count": 0.0, "default_service_role_sid": "RL1c0ab592f9724a10992c2ea29709f6cd", "media": {"compatibility_message": "Media messages are not supported by your client", "size_limit_mb": 150.0}, "default_channel_creator_role_sid": "RL3efa7fddc245451cbb76cde110621614", "reachability_enabled": false, "webhook_filters": null, "post_webhook_retry_count": 0.0, "sid": "IS5fcc074f7ead44c99a0a24a374a7e19f", "pre_webhook_url": null, "notifications": {"removed_from_channel": {"enabled": false}, "log_enabled": false, "added_to_channel": {"enabled": false}, "new_message": {"enabled": false}, "invited_to_channel": {"enabled": false}}, "webhook_method": null, "limits": {"user_channels": 1000.0, "channel_members": 1000.0}, "url": "https://chat.twilio.com/v2/Services/IS5fcc074f7ead44c99a0a24a374a7e19f", "friendly_name": "Default Conversations Service", "account_sid": "ACdade166c12e160e9ed0a6088226718fb", "date_created": "2023-03-21T13:35:15Z", "default_channel_role_sid": "RLca3ff6cb9bc9404caf14e43b63fed446", "links": {"channels": "https://chat.twilio.com/v2/Services/IS5fcc074f7ead44c99a0a24a374a7e19f/Channels", "bindings": "https://chat.twilio.com/v2/Services/IS5fcc074f7ead44c99a0a24a374a7e19f/Bindings", "users": "https://chat.twilio.com/v2/Services/IS5fcc074f7ead44c99a0a24a374a7e19f/Users", "roles": "https://chat.twilio.com/v2/Services/IS5fcc074f7ead44c99a0a24a374a7e19f/Roles"}}, "emitted_at": 1684513526771}
3 changes: 2 additions & 1 deletion airbyte-integrations/connectors/source-twilio/metadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ data:
- api.twilio.com
- monitor.twilio.com
- chat.twilio.com
- trunking.twilio.com
connectorSubtype: api
connectorType: source
definitionId: b9dc6155-672e-42ea-b10d-9f1f1fb95ab1
dockerImageTag: 0.6.0
dockerImageTag: 0.7.0
dockerRepository: airbyte/source-twilio
githubIssueLabel: source-twilio
icon: twilio.svg
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Trunks Schema",
"additionalProperties": true,
"type": ["null", "object"],
"properties": {
"sid": {
"type": ["null", "string"]
},
"account_sid": {
"type": ["null", "string"]
},
"domain_name": {
"type": ["null", "string"]
},
"disaster_recovery_method": {
"type": ["null", "string"]
},
"disaster_recovery_url": {
"type": ["null", "string"]
},
"friendly_name": {
"type": ["null", "string"]
},
"secure": {
"type": ["null", "boolean"]
},
"cnam_lookup_enabled": {
"type": ["null", "boolean"]
},
"recording": {
"type": ["null", "object"],
"properties": {
"mode": {
"type": ["null", "string"]
},
"trim": {
"type": ["null", "string"]
}
}
},
"transfer_mode": {
"type": ["null", "string"]
},
"transfer_caller_id": {
"type": ["null", "string"]
},
"auth_type": {
"type": ["null", "string"]
},
"auth_type_set": {
"type": ["null", "array"],
"items": {
"auth_type": {
"type": ["null", "string"]
}
}
},
"date_created": {
"type": ["null", "string"],
"format": "date-time"
},
"date_updated": {
"type": ["null", "string"],
"format": "date-time"
},
"url": {
"type": ["null", "string"]
},
"links": {
"type": ["null", "object"],
"properties": {
"origination_urls": {
"type": ["null", "string"]
},
"credential_lists": {
"type": ["null", "string"]
},
"ip_access_control_lists": {
"type": ["null", "string"]
},
"phone_numbers": {
"type": ["null", "string"]
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
Roles,
Services,
Transcriptions,
Trunks,
UsageRecords,
UsageTriggers,
)
Expand Down Expand Up @@ -115,6 +116,7 @@ def streams(self, config: Mapping[str, Any]) -> List[Stream]:
Roles(**full_refresh_stream_kwargs),
Services(**full_refresh_stream_kwargs),
Transcriptions(**full_refresh_stream_kwargs),
Trunks(**full_refresh_stream_kwargs),
UsageRecords(**incremental_stream_kwargs),
UsageTriggers(**full_refresh_stream_kwargs),
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
TWILIO_MONITOR_URL_BASE = "https://monitor.twilio.com/v1/"
TWILIO_STUDIO_API_BASE = "https://studio.twilio.com/v1/"
TWILIO_CONVERSATIONS_URL_BASE = "https://conversations.twilio.com/v1/"
TWILIO_TRUNKING_URL_BASE = "https://trunking.twilio.com/v1/"


class TwilioStream(HttpStream, ABC):
Expand Down Expand Up @@ -477,6 +478,17 @@ class Transcriptions(TwilioNestedStream):
parent_stream = Accounts


class Trunks(TwilioStream):
"""
https://www.twilio.com/docs/sip-trunking/api/trunk-resource#trunk-properties
"""

url_base = TWILIO_TRUNKING_URL_BASE

def path(self, **kwargs):
return "Trunks"


class Queues(TwilioNestedStream):
"""https://www.twilio.com/docs/voice/api/queue-resource#read-multiple-queue-resources"""

Expand Down
2 changes: 2 additions & 0 deletions docs/integrations/sources/twilio.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ The Twilio source connector supports the following [sync modes](https://docs.air
* [Services](https://www.twilio.com/docs/chat/rest/service-resource#read-multiple-service-resources)
* [Roles](https://www.twilio.com/docs/chat/rest/role-resource#read-multiple-role-resources)
* [Transcriptions](https://www.twilio.com/docs/voice/api/recording-transcription?code-sample=code-read-list-all-transcriptions&code-language=curl&code-sdk-version=json#read-multiple-transcription-resources)
* [Trunks](https://www.twilio.com/docs/sip-trunking/api/trunk-resource#trunk-properties)
* [Usage Records](https://www.twilio.com/docs/usage/api/usage-record#read-multiple-usagerecord-resources) \(Incremental\)
* [Usage Triggers](https://www.twilio.com/docs/usage/api/usage-trigger#read-multiple-usagetrigger-resources)

Expand All @@ -90,6 +91,7 @@ For more information, see [the Twilio docs for rate limitations](https://support

| Version | Date | Pull Request | Subject |
|:--------|:-----------|:----------------------------------------------------------|:--------------------------------------------------------------------------------------------------------|
| 0.7.0 | 2023-05-03 | [25781](https://github.com/airbytehq/airbyte/pull/25781) | Add new stream `Trunks` |
| 0.6.0 | 2023-05-03 | [](https://github.com/airbytehq/airbyte/pull/) | Add new stream `Roles` with parent `Services` |
| 0.5.0 | 2023-03-21 | [23995](https://github.com/airbytehq/airbyte/pull/23995) | Add new stream `Conversation Participants` |
| 0.4.0 | 2023-03-18 | [23995](https://github.com/airbytehq/airbyte/pull/23995) | Add new stream `Conversation Messages` |
Expand Down

0 comments on commit 53d66be

Please sign in to comment.