Skip to content

Commit

Permalink
New Components - seven (#13936)
Browse files Browse the repository at this point in the history
* new components

* pnpm-lock.yaml

* fix key
  • Loading branch information
michelle0927 committed Sep 17, 2024
1 parent fd6abb7 commit a48cf80
Show file tree
Hide file tree
Showing 10 changed files with 290 additions and 72 deletions.
3 changes: 0 additions & 3 deletions components/seven/.gitignore

This file was deleted.

30 changes: 30 additions & 0 deletions components/seven/actions/lookup-cnam/lookup-cnam.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import seven from "../../seven.app.mjs";

export default {
key: "seven-lookup-cnam",
name: "Lookup CNAM",
description: "Look up caller name information via Seven. [See the documentation](https://docs.seven.io/en/rest-api/endpoints/lookup#cnam)",
version: "0.0.1",
type: "action",
props: {
seven,
number: {
propDefinition: [
seven,
"number",
],
},
},
async run({ $ }) {
const response = await this.seven.lookupCnam({
$,
params: {
number: this.number,
},
});
if (response.success) {
$.export("$summary", `Successfully looked up caller information for number: ${this.number}`);
}
return response;
},
};
30 changes: 30 additions & 0 deletions components/seven/actions/lookup-format/lookup-format.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import seven from "../../seven.app.mjs";

export default {
key: "seven-lookup-format",
name: "Lookup Format",
description: "Look up phone number formatting via Seven. [See the documentation](https://docs.seven.io/en/rest-api/endpoints/lookup#format)",
version: "0.0.1",
type: "action",
props: {
seven,
number: {
propDefinition: [
seven,
"number",
],
},
},
async run({ $ }) {
const response = await this.seven.lookupFormat({
$,
params: {
number: this.number,
},
});
if (response.success) {
$.export("$summary", `Successfully looked up phone number formatting for number: ${this.number}`);
}
return response;
},
};
30 changes: 30 additions & 0 deletions components/seven/actions/lookup-hlr/lookup-hlr.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import seven from "../../seven.app.mjs";

export default {
key: "seven-lookup-hlr",
name: "Lookup HLR",
description: "Look up home location register information via Seven. [See the documentation](https://docs.seven.io/en/rest-api/endpoints/lookup#hlr)",
version: "0.0.1",
type: "action",
props: {
seven,
number: {
propDefinition: [
seven,
"number",
],
},
},
async run({ $ }) {
const response = await this.seven.lookupHlr({
$,
params: {
number: this.number,
},
});
if (response.success) {
$.export("$summary", `Successfully looked up location register information for number: ${this.number}`);
}
return response;
},
};
34 changes: 34 additions & 0 deletions components/seven/actions/make-tts-call/make-tts-call.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import seven from "../../seven.app.mjs";

export default {
key: "seven-make-tts-call",
name: "Make TTS Call",
description: "Make a text-to-speech call via Seven. [See the documentation](https://docs.seven.io/en/rest-api/endpoints/voice#send-voice-call)",
version: "0.0.1",
type: "action",
props: {
seven,
to: {
propDefinition: [
seven,
"to",
],
},
text: {
type: "string",
label: "Text",
description: "Text message to be read out",
},
},
async run({ $ }) {
const response = await this.seven.sendTtsCall({
$,
data: {
to: this.to,
text: this.text,
},
});
$.export("$summary", `Successfully sent TTS call to number: ${this.to}`);
return response;
},
};
34 changes: 34 additions & 0 deletions components/seven/actions/send-sms/send-sms.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import seven from "../../seven.app.mjs";

export default {
key: "seven-send-sms",
name: "Send SMS",
description: "Send SMS via Seven. [See the documentation](https://docs.seven.io/en/rest-api/endpoints/sms#send-sms)",
version: "0.0.1",
type: "action",
props: {
seven,
to: {
propDefinition: [
seven,
"to",
],
},
text: {
type: "string",
label: "Text",
description: "SMS message to send",
},
},
async run({ $ }) {
const response = await this.seven.sendSms({
$,
data: {
to: this.to,
text: this.text,
},
});
$.export("$summary", `Successfully sent SMS message to number: ${this.to}`);
return response;
},
};
13 changes: 0 additions & 13 deletions components/seven/app/seven.app.ts

This file was deleted.

10 changes: 6 additions & 4 deletions components/seven/package.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
{
"name": "@pipedream/seven",
"version": "0.0.1",
"version": "0.1.0",
"description": "Pipedream Seven Components",
"main": "dist/app/seven.app.mjs",
"main": "seven.app.mjs",
"keywords": [
"pipedream",
"seven"
],
"files": ["dist"],
"homepage": "https://pipedream.com/apps/seven",
"author": "Pipedream <[email protected]> (https://pipedream.com/)",
"publishConfig": {
"access": "public"
},
"dependencies": {
"@pipedream/platform": "^3.0.1"
}
}
}
71 changes: 71 additions & 0 deletions components/seven/seven.app.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
import { axios } from "@pipedream/platform";

export default {
type: "app",
app: "seven",
propDefinitions: {
number: {
type: "string",
label: "Number",
description: "The phone number to look up. (e.g. `49176123456789`)",
},
to: {
type: "string",
label: "To",
description: "The destination phone number. Accepts all common formats like `0049171123456789`, `49171123456789`, `+49171123456789`",
},
},
methods: {
_baseUrl() {
return "https://gateway.seven.io/api";
},
_headers() {
return {
Authorization: `Bearer ${this.$auth.oauth_access_token}`,
};
},
_makeRequest({
$ = this,
path,
...args
}) {
return axios($, {
url: `${this._baseUrl()}${path}`,
headers: this._headers(),
...args,
});
},
lookupCnam(opts = {}) {
return this._makeRequest({
path: "/lookup/cnam",
...opts,
});
},
lookupFormat(opts = {}) {
return this._makeRequest({
path: "/lookup/format",
...opts,
});
},
lookupHlr(opts = {}) {
return this._makeRequest({
path: "/lookup/hlr",
...opts,
});
},
sendSms(opts = {}) {
return this._makeRequest({
method: "POST",
path: "/sms",
...opts,
});
},
sendTtsCall(opts = {}) {
return this._makeRequest({
method: "POST",
path: "/voice",
...opts,
});
},
},
};
Loading

0 comments on commit a48cf80

Please sign in to comment.