@vulog/aima-config
v1.2.48
Published
Fleet configuration — cities, services, labels, and payment parameters.
Readme
@vulog/aima-config
Fleet configuration — cities, services, labels, and payment parameters.
Installation
npm install @vulog/aima-config @vulog/aima-client @vulog/aima-coreUsage
import { getClient } from '@vulog/aima-client';
import { getCities, getServices, getFleetConf } from '@vulog/aima-config';
const client = getClient({ /* client options */ });
const cities = await getCities(client);
const services = await getServices(client);
const conf = await getFleetConf(client);API Reference
getCities
getCities(client: Client): Promise<City[]>Returns cities matching the client's fleetId.
Params: client — Authenticated AIMA client
Returns: Promise<City[]>
getCitiesAllFranchises
getCitiesAllFranchises(client: Client): Promise<(City & { fleetId: string })[]>Returns all cities across all franchises, each annotated with its fleetId.
Params: client — Authenticated AIMA client
Returns: Promise<(City & { fleetId: string })[]>
getServices
getServices(client: Client): Promise<Service[]>Returns services matching the client's fleetId.
Params: client — Authenticated AIMA client
Returns: Promise<Service[]>
getServicesAllFranchises
getServicesAllFranchises(client: Client): Promise<(Service & { fleetId: string })[]>Returns all services across all franchises, each annotated with its fleetId.
Params: client — Authenticated AIMA client
Returns: Promise<(Service & { fleetId: string })[]>
getFleetConf
getFleetConf(client: Client): Promise<FleetConf>Returns fleet-level configuration.
Params: client — Authenticated AIMA client
Returns: Promise<FleetConf>
getLabels
getLabels(client: Client): Promise<Label[]>Returns all labels for the fleet.
Params: client — Authenticated AIMA client
Returns: Promise<Label[]>
addLabel
addLabel(client: Client, name: string): Promise<void>Creates a new label. name must be non-empty.
Params: client — Authenticated AIMA client; name — label name (non-empty)
Returns: Promise<void>
removeLabel
removeLabel(client: Client, labelId: number, cascade?: boolean): Promise<void>Deletes a label by ID. labelId must be a positive integer. cascade defaults to false; when true, also removes the label from all associated resources.
Params: client — Authenticated AIMA client; labelId — positive integer; cascade — optional, default false
Returns: Promise<void>
getPaymentParameters
getPaymentParameters(
client: Client,
serviceId?: string,
modelId?: string,
strict?: string
): Promise<PaymentParameters[] | null>Returns payment parameters, optionally filtered by service and model.
Params: client — Authenticated AIMA client; serviceId — optional; modelId — optional; strict — optional
Returns: Promise<PaymentParameters[] | null>
Types
City
interface City {
id: string;
name: string;
locale: string;
imagesUrl: string;
tokenIconsUrl?: string;
lat: number;
lon: number;
zoomLevel: number;
radius: number;
termsOfUseUrl: string;
termsOfUseUpdateDatetime: string;
faqUrl: string;
contactPhoneNumber: string;
agreementsDate: string;
timeZone: string;
distanceUnit: string;
contactUrl: string;
services: string[];
zoneId: string;
}Service
interface Service {
id: string;
name: string;
status: 'ACTIVE' | 'DISABLED';
type:
| 'FREE_FLOATING'
| 'FREE_FLOATING_STRICT'
| 'SERVICE_TRIP'
| 'BOOKING'
| 'ROUND_TRIP_BOOKING'
| 'BY_PASS_FREE_FLOATING'
| 'BY_PASS_ROUND_TRIP_BOOKING'
| 'SUBSCRIPTION'
| 'SCHEDULED_BOOKING_STATION';
cityId: string;
zones: string[];
vehicles: string[];
stations: string[];
pois: string[];
}FleetConf
interface FleetConf {
triggerSubscriptionPaymentInHours: number;
timeZone: string;
}Label
interface Label {
id: number;
name: string;
createDate: string;
}PaymentParameters
interface PaymentParameters {
id: string;
referenceId: string;
scope: 'RENTAL';
flow: 'MANDATORY';
amountType: 'FIXED' | 'PERCENTAGE';
amountValue: null | number;
fleetId: string;
providePreferredPaymentMethodPspReferences: boolean;
serviceId?: string;
modelIds?: string[];
}