GoMeddo - gomeddo/js-sdk GitHub Wiki

The main object of the GoMeddo SDK. This object is constructed to establish the connection with the Salesforce org through the widget proxy.

Example

import GoMeddo from "@gomeddo/sdk"

const gm = new GoMeddo('<api key>')
const resourceResult = await gm.buildResourceRequest().getResults()

Constructor

GoMeddo(apiKey, environment)

Parameters

  • apiKey The api key generated from the GoMeddo widget general settings page.
  • environment Environment enum. What environment to connect too. Default: Environment.PRODUCTION

Static properties

  • version The version of the sdk

Instance methods

buildResourceRequest

Syntax

buildResourceRequest()

Return value: A new ResourceRequest authenticated to the connection of the GoMeddo object.

Description Creates a new ResourceRequest authenticated to the connection of the GoMeddo object.


buildDimensionRecordRequest

Syntax

buildDimensionRecordRequest(dimensionName)

Parameters*

  • dimensionName The API name of the dimension object you want to request records for.

Return value: A new DimensionRecordRequest authenticated to the connection of the GoMeddo object.

Description Creates a new DimensionRecordRequest authenticated to the connection of the GoMeddo object.


buildReservationRequest

Syntax

buildReservationRequest()

Return value: A new ReservationRequest authenticated to the connection of the GoMeddo object.

Description Creates a new ReservationRequest authenticated to the connection of the GoMeddo object.


saveReservation

Syntax

saveReservation(reservation)

Parameters*

  • reservation A Reservation that should be created in the connected salesforce org. Return value: A new Reservation object with the fields of the old reservation and any newly populated or changed fields from salesforce.

Description Saves a reservation with any attached objects to the salesforce org. How and if the contact/lead will be saved and linked to the reservation is dependant on the settings in the salesforce org. The contact and lead will also be duplicate checked and if an existing lead/contact was found that will be linked instead.


updateReservation

equivalent to updateReservations([reservation])


updateReservations

Syntax

updateReservations(reservationList)

Description Updates a list of reservations including related sObjects. Will not create contacts or leads, only junction records and service reservations.


deleteReservation

equivalent to deleteReservations([reservation])


deleteReservations

Syntax

deleteReservations(reservationList)

Description Deletes a reservation including junction sObjects and service reservations.


calculatePrice

Syntax

calculatePrice(reservation)

Parameters*

  • reservation A Reservation that will be sent to saleforce and have the price calculations ran on it. Return value: The same Reservation with the fields that the price calculation calculates populated.

Description Runs the price calculation configured in salesforce for this reservation without inserting the reservation into the database. Meant to be used to display the price of the reservation to users before creating the reservation.


buildBlueprintRecordRequest

Syntax

buildBlueprintRecordRequest()

Return value: A new BlueprintRecordRequest authenticated to the connection of the GoMeddo object.

Description Creates a new BlueprintRecordRequest authenticated to the connection of the GoMeddo object.


buildBlueprintTimeSlotsRequest

Syntax

buildBlueprintTimeSlotsRequest()

Return value: A new BlueprintTimeslotsRequest authenticated to the connection of the GoMeddo object.

Description Creates a new BlueprintTimeslotsRequest authenticated to the connection of the GoMeddo object.


buildBlueprintFieldOptionsRequest

Syntax

buildBlueprintFieldOptionsRequest(blueprintIdentifier, fieldIdentifier)

Parameters

  • blueprintIdentifier The name/id of the blueprint the field to set is attached to.
  • fieldIdentifier The apiName/id of the field to set to retrieve options for.

Return value: A new BlueprintFieldOptionsRequest authenticated to the connection of the GoMeddo object.

Description Creates a new BlueprintFieldOptionsRequest authenticated to the connection of the GoMeddo object.

Environment

Example

import GoMeddo { Environment } from "@gomeddo/sdk"

const gm = new GoMeddo('<api key>', Environment.ACCEPTANCE)
const resourceResult = await gm.buildResourceRequest().getResults()

Description

Environment enum allows you to connect to different environments on the widget. Use the value corresponding to the widget page you created your api key from.

Values

  • ACCEPTANCE
  • STAGING
  • PRODUCTION
⚠️ **GitHub.com Fallback** ⚠️