0.34.2 • Published 18 days ago

@sweepbright/api-client v0.34.2

Weekly downloads
91
License
UNLICENCED
Repository
-
Last release
18 days ago

SweepBright SDK

Node package to access the SweepBright API programmatically.

This is is a work in progress and only some endpoints are supported. Feel free to extend it as required

Getting started

To install this package run

yarn add @sweepbright/api-client

Usage:

const { createClient } = require('@sweepbright/api-client');

const client = await createClient({
  clientId: 'CLIENT_ID',
  clientSecret: 'CLIENT_SECRET',
}).authorize({ scopes: ['companies:read'] });

const estate = await client.estates.getOne({ estateId: 'abcd-1234-fbgh' });

Authorization

As shown in the example below, before you can call any endpoint, you need to authenticate using against the private API. This is done by call the authorize function of the client and option parameter.

Options object

  • scopes - required - an list of the scopes to be granted. only resources with this scopes will be accessible afterwards

NOTE Some endpoints require to have a user token authorization. Currently this library does not provide a way to acquire such tokens. It assumes you already have one. To set a user token the method withUserToken on the client is available

Estates - getOne

Takes a single options parameter and returns a promise with the estate data

Options object

  • estateId - required - the id of the estate to get
  • includes - optional - a array of strings with extra subresources to include as part of the response

Estates - getAll

Takes a single options parameter and returns a paginated list of estates for a given company

Options object

  • companyId - required - the id of the company the estates are in
  • page - optional - when paginating the request, allows you specify the page you want to get
  • limit - optional - when paginating the request, allows you specify the number of items per page (defaults to 10)
  • archive - optional - when true, also archived properties will be returned, by default only non archived properties will be returned

Estates - getUnits

Allows to the units of a project.

Estates - createPublication

Allows to publish a property for a channel account, requires to be authorized with a user token. Takes a single options parameter and returns an empty response if the publication was scheduled successfully

Options object

  • estateId - required - the id of the estate that is going to be published
  • channelAccountId - required - the id of the channel account that is going to be used for publishing, needs to be in the same company the estate is
  • config - required - a configuration object, specific for each channel account type, which information about the publication config link(link missing)

Estates - updatePublication

Allows to update an existing property publication to a channel account, requires to be authorized with a user token. Takes a single options parameter and returns an empty response if the publication change was scheduled successfully

Options object

  • estateId - required - the id of the estate who's publication is going to be updated
  • channelAccountId - required - the id of the channel account of the publication
  • config - required - a configuration object, specific for each channel account type, which information about the publication config link(link missing)

Estates - unpublishPublication

Allows to remove an existing property publication, requires to be authorized with a user token. Takes a single options parameter and returns an empty response if the publication change was scheduled successfully

Options object

  • estateId - required - the id of the estate who's publication is going to be updated
  • channelAccountId - required - the id of the channel account of the publication

Contacts - getOne

Takes a single options parameter and returns a promise with the contact data

Options object

  • contactId - required - the id of the contact to return

Contacts - getAll

Takes a single options parameter and returns a promise with a paginated list of contacts for a specific company

Options object

  • companyId - required - the id of the company from which to get the contacts
  • page - optional - when paginating the request, allows you specify the page you want to get
  • limit - optional - when paginating the request, allows you specify the number of items per page (defaults to 10)

Leads - createLead

Creates a buyer lead which is assigned to the office of the property it was interested in and an interaction is recorded. Takes a single options parameter and returns a promise with the created lead data

Options object

  • firstName - optional - the given name of the lead
  • lastName - required - the family name of the lead
  • email - required without phone - the email of the lead
  • phone - required without email - the phone number of the lead
  • message - required - a string with extra info
  • location_preference.country - required with location_preference - the country code of the preferred location
  • location_preference.postal_codes - required with location_preference - array of postal_codes

Leads - createUnassignedLead

Creates a unassigned lead in a given company. Takes a single options parameter and returns a promise with the created lead data

Options object

  • companyId - required - the id of the company the lead belongs to
  • attributes.first_name -required - the given name of the lead
  • attributes.last_name - required - the family name of the lead
  • attributes.phone - required - the phone number of the lead
  • attributes.email - required - the phone number of the lead
  • attributes.message - required - a string with extra info
  • attributes.source_type - required - one of `"channel", (some other not documented and really difficult to get an answer from the backend)
  • attributes.external_source - required - a string with the name of the external source
  • attributes.preferences.negotiation - required - the type of transaction the lead wants
  • attributes.preferences.condition - required - the minimum condition required (one of 'poor', 'fair',' good', 'mint', 'new')

  • attributes.preferences.min_price - optional - number, the min. price of the property

  • attributes.preferences.max_price - optional - number, the max. price of the property

  • attributes.preferences.min_rooms - optional - number - the minimum number of rooms

  • attributes.preferences.locale - optional - the locale of the user

  • attributes.location_preference.country - required - the country code of the preferred location

  • attributes.location_preference.postal_codes - required - array of postal_codes

Companies - get

Returns a company. Takes a single options parameter and returns a promise with the company data

Options object

  • companyId - required - the id of the company to return
  • includes - optional - a list of includes to return

Development

This repository was initialized using TSDX. Check their docs for information about the different commands available.

Publication

Publication is configured in Github Actions. The flow is the following: "Version Tag -> Github Release".

In master branch:

  • run yarn version and select a new version
  • yarn will create a commit and a version tag
  • push the changes together with tag
  • go to Releases / Tags
  • find your new tag and click "Create Release From Tag" button
  • save the release
  • go to Actions and make sure the NPM package is being published
0.34.2

18 days ago

0.34.1

20 days ago

0.32.1

9 months ago

0.29.9

11 months ago

0.32.0

9 months ago

0.29.8

11 months ago

0.29.6

11 months ago

0.33.2

9 months ago

0.33.0

9 months ago

0.30.9

11 months ago

0.30.8

11 months ago

0.30.7

11 months ago

0.30.6

11 months ago

0.30.5

11 months ago

0.34.0

8 months ago

0.30.4

11 months ago

0.30.3

11 months ago

0.30.2

11 months ago

0.30.1

11 months ago

0.31.7

10 months ago

0.31.6

10 months ago

0.31.5

10 months ago

0.31.4

10 months ago

0.31.3

10 months ago

0.33.1-next

9 months ago

0.31.1

11 months ago

0.31.0

11 months ago

0.33.0-hotfix.1

9 months ago

0.33.0-hotfix.0

9 months ago

0.29.0

1 year ago

0.29.4

1 year ago

0.29.3

1 year ago

0.29.2

1 year ago

0.29.1

1 year ago

0.27.0

1 year ago

0.28.0

1 year ago

0.26.3

2 years ago

0.26.2

2 years ago

0.26.1

3 years ago

0.26.0

3 years ago

0.25.3

3 years ago

0.25.2

3 years ago

0.25.1

3 years ago

0.25.0

3 years ago

0.24.0

4 years ago

0.23.0

4 years ago

0.20.0

4 years ago

0.19.0

4 years ago

0.21.1

4 years ago

0.21.0

4 years ago

0.22.0

4 years ago

0.18.6

4 years ago

0.18.4

4 years ago

0.18.5

4 years ago

0.18.3

4 years ago

0.18.2

4 years ago

0.18.1

4 years ago

0.18.0

4 years ago

0.17.0

4 years ago

0.16.0

4 years ago

0.14.0

4 years ago

0.15.0

4 years ago

0.14.1

4 years ago

0.14.2

4 years ago

0.14.3

4 years ago

0.13.0

4 years ago

0.13.1

4 years ago

0.13.2

4 years ago

0.12.0

4 years ago

0.11.0

4 years ago

0.10.0

4 years ago

0.9.4

4 years ago

0.9.3

4 years ago

0.9.2

4 years ago

0.9.1

4 years ago

0.9.0

4 years ago

0.7.1

4 years ago

0.8.3

4 years ago

0.8.2

4 years ago

0.8.1

4 years ago

0.8.0

4 years ago

0.7.0

4 years ago

0.6.3

4 years ago

0.6.2

4 years ago

0.6.1

4 years ago

0.6.0

4 years ago

0.5.0

4 years ago

0.3.5

4 years ago

0.4.0

4 years ago

0.3.4

4 years ago

0.3.2

4 years ago

0.3.3

4 years ago

0.3.1

4 years ago

0.2.0

4 years ago

0.1.2

4 years ago

0.1.1

4 years ago

0.0.1

4 years ago

0.1.0

4 years ago