feat: Convert all app files to JS
This commit is contained in:
@@ -1,3 +1,3 @@
|
||||
import listIncomingPhoneNumbers from './list-incoming-phone-numbers';
|
||||
import listIncomingPhoneNumbers from './list-incoming-phone-numbers/index.js';
|
||||
|
||||
export default [listIncomingPhoneNumbers];
|
@@ -1,37 +1,16 @@
|
||||
import { IGlobalVariable, IJSONObject } from '@automatisch/types';
|
||||
|
||||
type TResponse = {
|
||||
data: IJSONObject[];
|
||||
error?: IJSONObject;
|
||||
};
|
||||
|
||||
type TIncomingPhoneNumber = {
|
||||
phone_number: string;
|
||||
friendly_name: string;
|
||||
sid: string;
|
||||
capabilities: {
|
||||
sms: boolean;
|
||||
};
|
||||
};
|
||||
|
||||
type TResponseData = {
|
||||
incoming_phone_numbers: TIncomingPhoneNumber[];
|
||||
next_page_uri: string;
|
||||
};
|
||||
|
||||
export default {
|
||||
name: 'List incoming phone numbers',
|
||||
key: 'listIncomingPhoneNumbers',
|
||||
|
||||
async run($: IGlobalVariable) {
|
||||
const valueType = $.step.parameters.valueType as string;
|
||||
async run($) {
|
||||
const valueType = $.step.parameters.valueType;
|
||||
const isSid = valueType === 'sid';
|
||||
|
||||
const aggregatedResponse: TResponse = { data: [] };
|
||||
const aggregatedResponse = { data: [] };
|
||||
let pathname = `/2010-04-01/Accounts/${$.auth.data.accountSid}/IncomingPhoneNumbers.json`;
|
||||
|
||||
do {
|
||||
const response = await $.http.get<TResponseData>(pathname);
|
||||
const response = (await $.http.get) < TResponseData > pathname;
|
||||
|
||||
for (const incomingPhoneNumber of response.data.incoming_phone_numbers) {
|
||||
if (incomingPhoneNumber.capabilities.sms === false) {
|
Reference in New Issue
Block a user