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

homeaway

v0.2.7

Published

An unofficial client for the HomeAway API

Downloads

1

Readme

About

node-homeaway is an unofficial HomeAway API client for Node. It is in no way affiliated with either HomeAway, Inc. or Expedia, Inc.

It is very much a work-in-progress and API methods are being added on an as-needed basis.

Getting Started

  1. Get access to the HomeAway API. They ask you a few questions about what you want to build, but I was given access immediately after filling out the form.
  2. Create a client.
  3. Install this module with npm install homeaway

Using node-homeaway

Here's a simple example, where the client and secret are provided upon creating your client on the HomeAway website.

const ha = new HomeAway({
  client:'your-client-id-here',
  secret: 'your-secret-here'
})

async function myFunc(){
  try{
    // connect() and all other methods on ha could throw.
    // You should catch these errors somewhere within your app.
    await ha.connect()
    const listing = await ha.getListing('6592159',['LOCATION','RATES'])
    console.log(listing)
  }
  catch(e){
    console.log(e)
  }
}

myFunc()

As you can see, node-homeaway makes use of some more cutting-edge JS features, like async/await. As such, it requires Node 8 or above.

For more examples, check out the examples photo in this repo.

Supported Methods:

Methods are being added on an as-needed basis. Feel free to submit a PR if you want to implement a missing one yourself.

Getting a Listing

Method signature: async getListing(id,attributes)

  • id is a string corresponding to the id of the listing.
  • attributes is an array of additional details to return with the listing, for example PHOTOS or AVAILABILITY.

It corresponds to the GET /public/listing API method.

Getting a User Token

User tokens are required for methods that access user account information. If you don't need to access user account information, its much easier to not bother with this at all. Getting these tokens is a three step process.

  1. Redirect the user to a page on HomeAway's website on which they grant your app access to their account.
  2. Handle a request which includes an authorization code to your client redirect URL.
  3. Use that authorization code to get the final access token. This token will be used to make all subsequent requests for that user.

Step 1 should be handled by your app exclusively. Per the HomeAway API Docs, the URL you need to redirect users to is: https://ws.homeaway.com/oauth/authorize?client_id=<YOUR CLIENT ID>

Steps 2 and 3 are handled by node-homeaway. Depending on your needs, you can use one of two methods:

  1. If you're only using HomeAway as a login provider, you can get a thumbs-up/thumbs-down on whether a user is logged in (as well as their email) by calling the node-homeaway authenticate method. All other requests to the HomeAway API can be made with a call to an existing node-homeaway client.

  2. If you need to make calls to user-specific methods (eg. GET /public/me), you'll need to include the user access token with every method call (as the first argument).

The user access token should be stored with your client-side application (eg. in LocalStorage) and sent with every request to your Node backend.

You can generate a user access token by calling the node-homeaway getUserToken method. This should be called when the user is sent to the redirect URL you specified in your HomeAway client configuration.