0.3.10 • Published 2 years ago

@aequilibrium/rets-client v0.3.10

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

Typescript RETS Client

A RETS (Real Estate Transaction Standard) Client written in Typescript.

Install

if using yarn: yarn add @aequilibrium/rets-client

if using npm: npm i @aequilibrium/rets-client

Usage

import { getClient, RetsMetadataType, ReturnType } from '@aequilibrium/rets-client';

const config = {
  url: 'my-rets-url',
  username: 'my-rets-username',
  password: 'my-rets-password',
}

await getClient(config, async ({ search, getMetadata, getDataMap }) => {

  // Figure out the data structure
  const resources = await getMetadata({
    type: RetsMetadataType.Resource,
  })
  console.log('getMetadata.Resource', resources)

  const classes = await getMetadata({
    type: RetsMetadataType.Class,
  })
  console.log('getMetadata.Class', classes)

  // Build a Datamap of the RETS Data Structure
  const dataMap = await getDataMap()
  console.log('getDataMap', dataMap)


  // Search for data 
  const listings = await search({
    query: '(Status=A)',
    limit: 5,
    searchType: 'Property',
    className: 'ResidentialProperty',
    culture: DdfCulture.EN_CA,
  })
  console.log('listing', listings)

  // search for data using streams
  let count = 0
  const searchStream = (
    (await search({
      query: '(Status=A)',
      limit: 5,
      searchType: 'Property',
      className: 'ResidentialProperty',
      culture: DdfCulture.EN_CA,
      returnType: ReturnType.Stream,
    })) as Readable
  )
    .pipe(
      new Writable({
        objectMode: true,
        write: (data, _, done) => {
          count += 1
          done()
        },
      }),
    )
  // wait for the stream to finish
  await new Promise((fulfill) => searchStream.on('close', fulfill))
  console.log('final Count', count)

  // retrieve some objects/images
})

Development/Configuration

If you're developing this app you can use the test file by setting up the user configuration by adding the following ot your .env file.

RETS_TEST_URL=http://www...
RETS_TEST_USERNAME=...
RETS_TEST_PASSWORD=...

and then run the test file by running: yarn start

Acknowledgements

Inspired by:

0.3.10

2 years ago

0.3.9

3 years ago

0.3.8

3 years ago

0.3.7

3 years ago

0.3.6

3 years ago

0.3.5

3 years ago

0.3.2

3 years ago

0.3.1

3 years ago

0.3.4

3 years ago

0.3.3

3 years ago

0.3.0

3 years ago

0.2.18

3 years ago

0.2.17

3 years ago

0.2.16

3 years ago

0.2.15

3 years ago

0.2.13

3 years ago

0.2.12

3 years ago

0.2.10

3 years ago

0.2.7

3 years ago

0.2.6

3 years ago

0.2.9

3 years ago

0.2.8

3 years ago

0.2.5

3 years ago

0.2.3

3 years ago

0.2.2

3 years ago

0.2.4

3 years ago

0.2.1

3 years ago

0.2.0

3 years ago

0.1.0

3 years ago