Skip to content

Commit

Permalink
chore: refactor the Twilio vendor extensions into single object (twil…
Browse files Browse the repository at this point in the history
  • Loading branch information
childish-sambino committed Jun 10, 2021
1 parent 7b77c20 commit a2e0fca
Show file tree
Hide file tree
Showing 36 changed files with 4,822 additions and 3,642 deletions.
11 changes: 6 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
language: node_js
node_js:
- node
- lts/*
- '10'
# Disabling for Node 16 until audit issue is resolved: https://travis-ci.com/github/twilio/twilio-cli-core/jobs/512495850
# - node
- lts/*
- '10'
before_install:
- sudo apt-get update
- sudo apt-get install -y libsecret-1-dev
- sudo apt-get update
- sudo apt-get install -y libsecret-1-dev
deploy:
provider: npm
email: team_interfaces@twilio.com
Expand Down
11 changes: 5 additions & 6 deletions src/services/twilio-api/api-browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,12 @@ class TwilioApiBrowser {
}
});

// Convert extensions to camel-cased properties.
// Lift the Twilio vendor extension properties.
Object.entries(path).forEach(([key, value]) => {
const extensionMatch = key.match(/x-(.+)/);

if (extensionMatch) {
const newKey = camelCase(extensionMatch[1]);
path[newKey] = value;
if (key === 'x-twilio') {
Object.entries(value).forEach(([subKey, subValue]) => {
path[subKey] = subValue;
});
delete path[key];
}
});
Expand Down
84 changes: 48 additions & 36 deletions src/services/twilio-api/twilio_accounts_v1.json
Original file line number Diff line number Diff line change
Expand Up @@ -221,12 +221,14 @@
"url": "https://accounts.twilio.com"
}
],
"x-default-output-properties": [
"account_sid",
"auth_token",
"date_created"
],
"x-path-type": "instance"
"x-twilio": {
"defaultOutputProperties": [
"account_sid",
"auth_token",
"date_created"
],
"pathType": "instance"
}
},
"/v1/AuthTokens/Secondary": {
"delete": {
Expand Down Expand Up @@ -276,12 +278,14 @@
"url": "https://accounts.twilio.com"
}
],
"x-default-output-properties": [
"account_sid",
"secondary_auth_token",
"date_created"
],
"x-path-type": "instance"
"x-twilio": {
"defaultOutputProperties": [
"account_sid",
"secondary_auth_token",
"date_created"
],
"pathType": "instance"
}
},
"/v1/Credentials/AWS": {
"description": "User provided AWS keys",
Expand Down Expand Up @@ -419,12 +423,14 @@
"url": "https://accounts.twilio.com"
}
],
"x-default-output-properties": [
"sid",
"friendly_name",
"date_created"
],
"x-path-type": "list"
"x-twilio": {
"defaultOutputProperties": [
"sid",
"friendly_name",
"date_created"
],
"pathType": "list"
}
},
"/v1/Credentials/AWS/{Sid}": {
"delete": {
Expand Down Expand Up @@ -556,12 +562,14 @@
"url": "https://accounts.twilio.com"
}
],
"x-default-output-properties": [
"sid",
"friendly_name",
"date_created"
],
"x-path-type": "instance"
"x-twilio": {
"defaultOutputProperties": [
"sid",
"friendly_name",
"date_created"
],
"pathType": "instance"
}
},
"/v1/Credentials/PublicKeys": {
"description": "User provided public keys",
Expand Down Expand Up @@ -699,12 +707,14 @@
"url": "https://accounts.twilio.com"
}
],
"x-default-output-properties": [
"sid",
"friendly_name",
"date_created"
],
"x-path-type": "list"
"x-twilio": {
"defaultOutputProperties": [
"sid",
"friendly_name",
"date_created"
],
"pathType": "list"
}
},
"/v1/Credentials/PublicKeys/{Sid}": {
"delete": {
Expand Down Expand Up @@ -836,12 +846,14 @@
"url": "https://accounts.twilio.com"
}
],
"x-default-output-properties": [
"sid",
"friendly_name",
"date_created"
],
"x-path-type": "instance"
"x-twilio": {
"defaultOutputProperties": [
"sid",
"friendly_name",
"date_created"
],
"pathType": "instance"
}
}
},
"servers": [
Expand Down

0 comments on commit a2e0fca

Please sign in to comment.