New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@encheres-immo/widget-client

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@encheres-immo/widget-client

Middleware to use Enchères Immo's API in your JavaScript application

  • 0.4.0
  • npm
  • Socket score

Version published
Weekly downloads
18
increased by12.5%
Maintainers
1
Weekly downloads
 
Created
Source

Enchères Immo's widget client

Quickly integrate Enchères Immo's API in your own auction JavaScript/TypeScript widget. Provides a simple interface to fetch auctions, authenticate users and place bids 🚀

Prerequisites

To use this widget, you need an API key from Enchères Immo. If you are a real estate professional and not yet a partner of Enchères Immo, please book a demo to get started. If you are already a partner, contact us to get your API key.

Useful commands

All commands are run from the root of the package.

CommandDescription
pnpm installInstall dependencies
pnpm run buildBuild the package
pnpm run watchBuild the package and watch for changes
pnpm run testRun the tests

Important notes

This package is built with TypeScript, and not bundled or minified. It is intended to be used as a module in your own auction widget, which should be bundled and minified for production.

Enchères Immo's protect your API access by restricting it to specific domains. But you should be careful with user authentication tokens, and ensure that they are securely managed and stored.

Finally, this client uses the WebSocket API to communicate with the server. Be mindful of managing the connection lifecycle (e.g., disconnecting when no longer needed).

Usage

Below are simple examples demonstrating how to use Enchères Immo's widget client with TypeScript.

Setup

First, import the client and initialize it.

import client from "@encheres-immo/widget-client";

// Replace by your API key
client.initEIClient(api_key);

Authentication

To authenticate the user, call the authenticate method. This will handle the OAuth2 flow and obtain an access token.

await client.authenticate();

After authentication, you can retrieve the authenticated user's details:

const user = await client.me();
console.log('User:', user);

Fetching Auction Details

To fetch details of the next auction for a property, use the getNextAuctionById method, with the Enchères Immo property ID:

const propertyInfo = {
  propertyId: 'your-property-id', // Replace with your property ID
};

const auction = await client.getNextAuctionById(propertyInfo);
console.log('Auction:', auction);

Alternatively, you can use your CRM property ID:

const propertyInfo = {
  source: 'crm-source',         // Replace with your CRM ID (e.g., 'apimo')
  sourceAgencyId: 'agency-id',  // Replace with your agency ID in your CRM
  sourceId: 'source-id',        // Replace with the property ID in your CRM
};

const auction = await client.getNextAuctionById(propertyInfo);
console.log('Auction:', auction);

Subscribing to Auction Updates

To receive real-time updates for an auction, such as new bids, subscribe to the auction channel:

function onNewBid(bid) {
  console.log('New bid received:', bid);
}

// Subscribe to auction updates
await client.subscribeToAuction(auction.id, onNewBid);

Registering on an Auction

To allows the connected user to register for a specific auction., use the registerOnAuction method:

const registration = await client.registerOnAuction(auction);
console.log('Registration:', registration);

This registration must be accepted by the agent later, or the user will not be able to place bids.

Placing a Bid

To place a bid on an auction, use the placeBidOnAuction method:

const bidAmount = 100000; // Replace with your bid amount
const bid = await client.placeBidOnAuction(auction, bidAmount);
console.log('Bid placed:', bid);

Note that you need to be authenticated and authorized to place a bid.

FAQs

Package last updated on 10 Dec 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc