1.0.0-beta8 • Published 6 years ago
@parkmobile/client v1.0.0-beta8
parkmobile-client
A JavaScript client for ParkMobile's API.
Installation
yarn add @parkmobile/client
Getting Started
Create a Client
Create a new Parkmobile Client by passing a version, sourceAppKey, and optional cache
import ParkmobileClient, { VERSIONS } from '@parkmobile/client';
const client = Client({
cache: undefined,
version: VERSIONS.production,
sourceAppKey: 'parkmobileWeb',
});
Subscribe to a Query
Create a query from one of the Parkmobile Models, like a Zone.
import { Zone } from '@parkmobile/client';
const startDate = new Date();
const endDate = new Date(startDate.getHours() + 3);
const centerPoint = {
latitude: 33.775591,
longitude: -84.392190,
};
const upperPoint = {
latitude: 33.798561,
longitude: -84.411599,
};
const lowerPoint = {
latitude: 33.729035,
longitude: -84.342527,
};
client.subscribe(Zone.queries.searchReservations({
endDate,
startDate,
centerPoint,
lowerPoint,
upperPoint,
}), ({ data, error, pending }) => {
if (pending) {
return drawLoadingIndicator();
}
if (error) {
return drawError(error);
}
return drawMarkers(data);
});
1.0.0-beta8
6 years ago
1.0.0-beta7
6 years ago
1.0.0-beta6
6 years ago
1.0.0-beta5
6 years ago
1.0.0-beta4
6 years ago
1.0.0-beta3
6 years ago
1.0.0-beta2
6 years ago
1.0.0-beta1
6 years ago