npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

telstra-api

v0.2.1

Published

A node.js module for interfacing with the Telstra Dev APIs

Downloads

3

Readme

Telstra-API - v0.2

Telstra-API is a node.js module that takes the hard work out of using Telstra Developer APIs.

Included APIs

The Connect API and Mobile Connect API will not be included in this module.

Installation

The easiest (and only supported) way to install Telstra-API is by using NPM (Node Package Manager) from the command line.

$ npm install telstra-api

Usage

// Obtain these keys from the Telstra Developer Portal
CONSUMER_KEY = "U62RDEGRxb4Jw2p30oHkMnBLJaSJG5IS";
CONSUMER_SECRET = "PTbyss26edeKr1cs";

// Scope should contain a list of required APIs, seperated by a space (0x20).
SCOPE = "SMS WIFI";

TelstraAPI = require('telstra-api');
var t = new TelstraAPI(CONSUMER_KEY, CONSUMER_SECRET, SCOPE);

NOTE: It is important to make sure you're using the correct CONSUMER_KEY and CONSUMER_SECRET, as well as specifying only the scope(s) that your application has access to in the Telstra Developer Portal, as all authentication failures (not API errors) will result in a printed stack trace, and the application exiting.

SMS API - t.sms

t.sms.send(string <target>, string <message>);

  • target: Australian telephone phone number to deliver SMS.
  • message: The message to be delivered.

Returns: (String) The message ID of the pending SMS.

t.sms.getFullReplies(String <messageId>);

messageID: The message ID received from a previous call to t.sms.send()

Returns: An object containing:

  • String from: The number from which the SMS is received.
  • String acknowledgedTimestamp: The time that the message was received by the SMS service.
  • String content: The content of the SMS.

[Example Request & Result]

t.sms.getFullStatus(String <messageId>);

messageID: The message ID received from a previous call to t.sms.send()

Returns: An object containing:

  • String to: The target number supplied to t.sms.send().
  • String receivedTimestamp: The time that the message was received by the target network.
  • String sentTimestamp: The time that the message was sent.
  • String status: A status representing the current send status of the message.

[Example Request & Result]

t.sms.getReplies(String <messageId>);

messageID: The message ID received from a previous call to t.sms.send()

Returns: An array of (String) replys - See: t.sms.getFullReplies()

t.sms.getStatus(String <messageId>);

messageID: The message ID received from a previous call to t.sms.send()

Returns: (String) status - See: status in t.sms.getFullStatus()

 

WiFi API - t.wifi

t.wifi.getHotspots(Number <latitude>, Number <longitude>, Number [radius]);

Retrieves the location of nearby Telstra owned WiFi Hotspots in Australia (Telstra AIR).

  • Latitude: The latitude of the centre of the search area.
  • Longitude: The longitude of the centre of the search area.
  • Radius: The radius (in metres) of the area to be searched. Defaults to 2000.

Returns: (Array) An array of up to 10 Objects containing:

  • Number lat: The latitude of the hotspot
  • Number long: The longitude of the hotspot.
  • String address: A description of the hotspot's location.
  • String city: The suburb containing the hotspot.
  • String state: The state containing the hotspot.

[Example Request & Result]

Promises

Due to the asynchronous nature of this module, we have chosen to implement all methods using Promises. When we refer to a method returning a value, the method will return a promise that should resolve to that value if no error has occured. If an error occurs, the promise will be rejected with an error object containing a descriptive message.

Here's a quick example on how to use a promise returned by a method in this module. For more information on Promises and their usage, please refer to Promises on MDN.

t.&lt;api&gt;.&lt;method&gt;([arguments]).then(function (result) {
  //Successful call
  console.log("Result: " + result);
}, function (error) {
  //An error has occured.
  console.log("Error: " + error);
});

License - MIT License (MIT)

Copyright (c) 2016 Joshua 'JD' Davison

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.