Skip to content

pace/cloud-sdk-capacitor-plugin

Repository files navigation

cloud-sdk-capacitor-plugin

PACE Cloud SDK is a Capacitor plugin to easily integrate PACE's Connected Fueling into your own apps.

Install

npm install cloud-sdk-capacitor-plugin
npx cap sync

API

setup(...)

setup(config: Configuration) => Promise<boolean>

Setup the plugin

Param Type Description
config Configuration is the configuration provided to this method

Returns: Promise<boolean>


respondToEvent(...)

respondToEvent(response: EventResponse) => Promise<boolean>

Method that can to be called whenever the client wants to communicate to the plugin in regards to a received event

Param Type Description
response EventResponse is the response to a given event

Returns: Promise<boolean>


getNearbyGasStations(...)

getNearbyGasStations(options: { coordinate: [number, number]; radius: number; }) => Promise<{ results: GasStation[]; }>

Returns a list of gasStations based on a given coordinate

Param Type
options { coordinate: [number, number]; radius: number; }

Returns: Promise<{ results: GasStation[]; }>


isPoiInRange(...)

isPoiInRange(options: { poiId: string; coordinate: [number, number]; }) => Promise<{ result: boolean; }>

Check if there is a App for the given GasStation Id at the current location

Param Type
options { poiId: string; coordinate: [number, number]; }

Returns: Promise<{ result: boolean; }>


startApp(...)

startApp(options: { url: string | PresetUrl; }) => Promise<boolean>

Start an App via a url

Param Type
options { url: string; }

Returns: Promise<boolean>


startFuelingApp(...)

startFuelingApp(options: { poiId: string; }) => Promise<boolean>

Start an App for a given poiId

Param Type
options { poiId: string; }

Returns: Promise<boolean>


addListener(string, ...)

addListener(eventName: string, listenerFunc: ListenerCallback) => PluginListenerHandle
Param Type
eventName string
listenerFunc ListenerCallback

Returns: PluginListenerHandle


Interfaces

Configuration

Prop Type Description
apiKey string Use this property to provide the plugin with your PACE SDK API Key
authenticationMode AuthenticationMode If you use native logins, then this should be set to 'AuthenticationMode.NATIVE'. Defaults to 'AuthenticationMode.WEB'
environment Environment Set your environment to 'Environment.STAGE' or 'Environment.SANDBOX' while developing or running tests. Defaults to 'Environment.PRODUCTION'

EventResponse

Prop Type Description
id string The id must be the same as from the received event
name string The name must be the same as from the received event
value string In case the value is an object, make sure to stringify it first

GasStation

Prop Type Description
id string
name string
address Address
coordinates [number, number] A set of coordinates, as [lng, lat]
openingHours OpeningHour[] The opening hours for the Gas Station
fuelPrices FuelPrice[] The available fuel prices
isConnectedFuelingAvailable boolean Indicates if the gasStations supports Connected Fueling
lastUpdated Date

Address

Prop Type
countryCode string
city string
zipCode string
suburb string
state string
street string
houseNumber string

OpeningHour

Prop Type
day OpeningHourDay
hours [number, number][]

FuelPrice

Prop Type
fuelType FuelType
productName string
price number
priceFormatting string
unit FuelPriceUnit
currency FuelCurrency
updated number

Date

Enables basic storage and retrieval of dates and times.

Method Signature Description
toString () => string Returns a string representation of a date. The format of the string depends on the locale.
toDateString () => string Returns a date as a string value.
toTimeString () => string Returns a time as a string value.
toLocaleString () => string Returns a value as a string value appropriate to the host environment's current locale.
toLocaleDateString () => string Returns a date as a string value appropriate to the host environment's current locale.
toLocaleTimeString () => string Returns a time as a string value appropriate to the host environment's current locale.
valueOf () => number Returns the stored time value in milliseconds since midnight, January 1, 1970 UTC.
getTime () => number Gets the time value in milliseconds.
getFullYear () => number Gets the year, using local time.
getUTCFullYear () => number Gets the year using Universal Coordinated Time (UTC).
getMonth () => number Gets the month, using local time.
getUTCMonth () => number Gets the month of a Date object using Universal Coordinated Time (UTC).
getDate () => number Gets the day-of-the-month, using local time.
getUTCDate () => number Gets the day-of-the-month, using Universal Coordinated Time (UTC).
getDay () => number Gets the day of the week, using local time.
getUTCDay () => number Gets the day of the week using Universal Coordinated Time (UTC).
getHours () => number Gets the hours in a date, using local time.
getUTCHours () => number Gets the hours value in a Date object using Universal Coordinated Time (UTC).
getMinutes () => number Gets the minutes of a Date object, using local time.
getUTCMinutes () => number Gets the minutes of a Date object using Universal Coordinated Time (UTC).
getSeconds () => number Gets the seconds of a Date object, using local time.
getUTCSeconds () => number Gets the seconds of a Date object using Universal Coordinated Time (UTC).
getMilliseconds () => number Gets the milliseconds of a Date, using local time.
getUTCMilliseconds () => number Gets the milliseconds of a Date object using Universal Coordinated Time (UTC).
getTimezoneOffset () => number Gets the difference in minutes between the time on the local computer and Universal Coordinated Time (UTC).
setTime (time: number) => number Sets the date and time value in the Date object.
setMilliseconds (ms: number) => number Sets the milliseconds value in the Date object using local time.
setUTCMilliseconds (ms: number) => number Sets the milliseconds value in the Date object using Universal Coordinated Time (UTC).
setSeconds (sec: number, ms?: number | undefined) => number Sets the seconds value in the Date object using local time.
setUTCSeconds (sec: number, ms?: number | undefined) => number Sets the seconds value in the Date object using Universal Coordinated Time (UTC).
setMinutes (min: number, sec?: number | undefined, ms?: number | undefined) => number Sets the minutes value in the Date object using local time.
setUTCMinutes (min: number, sec?: number | undefined, ms?: number | undefined) => number Sets the minutes value in the Date object using Universal Coordinated Time (UTC).
setHours (hours: number, min?: number | undefined, sec?: number | undefined, ms?: number | undefined) => number Sets the hour value in the Date object using local time.
setUTCHours (hours: number, min?: number | undefined, sec?: number | undefined, ms?: number | undefined) => number Sets the hours value in the Date object using Universal Coordinated Time (UTC).
setDate (date: number) => number Sets the numeric day-of-the-month value of the Date object using local time.
setUTCDate (date: number) => number Sets the numeric day of the month in the Date object using Universal Coordinated Time (UTC).
setMonth (month: number, date?: number | undefined) => number Sets the month value in the Date object using local time.
setUTCMonth (month: number, date?: number | undefined) => number Sets the month value in the Date object using Universal Coordinated Time (UTC).
setFullYear (year: number, month?: number | undefined, date?: number | undefined) => number Sets the year of the Date object using local time.
setUTCFullYear (year: number, month?: number | undefined, date?: number | undefined) => number Sets the year value in the Date object using Universal Coordinated Time (UTC).
toUTCString () => string Returns a date converted to a string using Universal Coordinated Time (UTC).
toISOString () => string Returns a date as a string value in ISO format.
toJSON (key?: any) => string Used by the JSON.stringify method to enable the transformation of an object's data for JavaScript Object Notation (JSON) serialization.

PluginListenerHandle

Prop Type
remove () => Promise<void>

Type Aliases

ListenerCallback

(err: any, ...args: any[]): void

Enums

AuthenticationMode

Members Value
WEB 'web'
NATIVE 'native'

Environment

Members Value
PRODUCTION 'production'
DEVELOPMENT 'development'
STAGE 'stage'
SANDBOX 'sandbox'

OpeningHourDay

Members Value
MONDAY 'monday'
TUESDAY 'tuesday'
WEDNESDAY 'wednesday'
THURSDAY 'thursday'
FRIDAY 'friday'
SATURDAY 'saturday'
SUNDAY 'sunday'

FuelType

Members Value
RON98 'ron98'
RON98E5 'ron98e5'
RON95E10 'ron95e10'
DIESEL 'diesel'
E85 'e85'
RON91 'ron91'
RON95E5 'ron95e5'
RON100 'ron100'
DIESELGTL 'dieselGtl'
DIESELB7 'dieselB7'
DIESELPREMIUM 'dieselPremium'
LPG 'lpg'
CNG 'cng'
LNG 'lng'
H2 'h2'
TRUCKDIESEL 'truckDiesel'
ADBLUE 'adBlue'
TRUCKADBLUE 'truckAdBlue'
TRUCKDIESELPREMIUM 'truckDieselPremium'
TRUCKLPG 'truckLpg'
HEATINGOIL 'heatingOil'

FuelPriceUnit

Members Value
LITRE 'L'

FuelCurrency

Members Value
EUR 'EUR'

PresetUrl

Members Value
PACE_ID 'paceID'
PAYMENT 'payment'
TRANSACTIONS 'transactions'