Skip to content

Commit

Permalink
update console-search-and-order demo to typescript (#26)
Browse files Browse the repository at this point in the history
* update console-search-and-order demo to typescript

* update readme

* bump telnyx package version
  • Loading branch information
lucasassisrosa authored Oct 21, 2024
1 parent af866e0 commit 0a1718b
Show file tree
Hide file tree
Showing 10 changed files with 3,102 additions and 5,266 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/console-search-and-order.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: CI console-search-and-order

on:
push:
branches: [master]
paths:
- "console-search-and-order/**"
pull_request:
branches: [master]
paths:
- "console-search-and-order/**"

jobs:
type-check:
runs-on: ubuntu-latest
defaults:
run:
working-directory: console-search-and-order
strategy:
matrix:
node-version: [18.x, 20.x, 22.x]

steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- run: npm ci
- run: npm run type-check
9 changes: 9 additions & 0 deletions console-search-and-order/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module.exports = {
parserOptions: {
ecmaVersion: 6,
},
rules: {
'new-cap': 'off',
'no-console': 'off',
},
};
1 change: 1 addition & 0 deletions console-search-and-order/.nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
20.17.0
2 changes: 2 additions & 0 deletions console-search-and-order/.tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
nodejs 20.17.0
npm 10.8.1
19 changes: 9 additions & 10 deletions console-search-and-order/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,28 +16,28 @@ The full documentation and tutorial is available on [developers.telnyx.com](http

You will need to set up:

* [Telnyx Account](https://telnyx.com/sign-up?utm_source=referral&utm_medium=github_referral&utm_campaign=cross-site-link)
- [Telnyx Account](https://telnyx.com/sign-up?utm_source=referral&utm_medium=github_referral&utm_campaign=cross-site-link)

## What you can do

* Search toll-free or local
* Perform partial searches
* Order numbers
- Search toll-free or local
- Perform partial searches
- Order numbers

## Usage

The following environmental variables need to be set

| Variable | Description |
|:------------------------------|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| :---------------------------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `TELNYX_API_KEY` | Your [Telnyx API Key](https://portal.telnyx.com/#/app/api-keys?utm_source=referral&utm_medium=github_referral&utm_campaign=cross-site-link) |
| `TELNYX_CONNECTION_ID` | Your [Call-Control](https://portal.telnyx.com/#/app/call-control/applications) or [TeXML](https://portal.telnyx.com/#/app/call-control/texml) or [SIP Connection](https://portal.telnyx.com/#/app/connections) ID |
| `TELNYX_MESSAGING_PROFILE_ID` | Your [Messaging Profile Id](https://portal.telnyx.com/#/app/messaging) |
| `TELNYX_BILLING_GROUP_ID` | Your [Billing Group Id](https://portal.telnyx.com/#/app/account/billing-groups) |

### .env file

This app uses the excellent [dotenv](https://www.npmjs.com/package/dotenv) package to manage environment variables.
This app uses the [dotenv](https://www.npmjs.com/package/dotenv) package to manage environment variables.

Make a copy of [`.env.sample`](./.env.sample) and save as `.env` and update the variables to match your creds.

Expand All @@ -60,10 +60,9 @@ $ npm install

### Run

Run the Node script `node index.js` from the command line and answer the prompts to search and order
Run the Node script `npm run start` from the command line and answer the prompts to search and order

```
node index.js
```bash
✔ toll-free or local search?local
✔ areaCode to search? … 828
{
Expand All @@ -82,4 +81,4 @@ Run the Node script `node index.js` from the command line and answer the prompts
billing_group_id: '489c07f3-fb5e-4d1c-8f36-2089fb2ac3c8',
phone_numbers: [ { phone_number: '+18286720169' } ]
}
```
```
181 changes: 0 additions & 181 deletions console-search-and-order/index.js

This file was deleted.

Loading

0 comments on commit 0a1718b

Please sign in to comment.