/**
* Shell EVLib
*
* This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
*/
import { ApiResponse, RequestOptions } from '../core';
import {
GetEVLocationsAuthorizationMethodsEnum,
getEVLocationsAuthorizationMethodsEnumSchema,
} from '../models/getEVLocationsAuthorizationMethodsEnum';
import {
GetEVLocationsConnectorTypesEnum,
getEVLocationsConnectorTypesEnumSchema,
} from '../models/getEVLocationsConnectorTypesEnum';
import {
GetEVLocationsEvseStatusEnum,
getEVLocationsEvseStatusEnumSchema,
} from '../models/getEVLocationsEvseStatusEnum';
import {
NearbyLocationsConnectorTypesEnum,
nearbyLocationsConnectorTypesEnumSchema,
} from '../models/nearbyLocationsConnectorTypesEnum';
import { Response, responseSchema } from '../models/response';
import {
SingleLocationMarkerResponse,
singleLocationMarkerResponseSchema,
} from '../models/singleLocationMarkerResponse';
import { array, boolean, number, optional, string } from '../schema';
import { BaseController } from './baseController';
import { BadRequestError } from '../errors/badRequestError';
import { InternalServerError } from '../errors/internalServerError';
import { NotFoundError } from '../errors/notFoundError';
import { ServiceunavailableError } from '../errors/serviceunavailableError';
import { TooManyRequestsError } from '../errors/tooManyRequestsError';
import { UnauthorizedError } from '../errors/unauthorizedError';
export class LocationsController extends BaseController {
/**
* This API provides the list of all Shell Recharge locations. The list includes all Shell Recharge
* network and all locations available through our roaming partners. The end point provides flexible
* search criteria in order to get the list of Shell Recharge Network. The end point provides the
* details such as the exact location/address of the site along with the up-to-date status information
* of all the charging units in the site.
*
* Supported Search Options
*
* * Based on status of the Charging units. Eg : Available or Occupied
* * Based on available connector types.
* * Based on minimum Power output (in kW) available
* * Based on a specific charging unit ID (EVSE ID)
*
* @param requestId RequestId must be unique identifier value
* that can be used by the consumer to
* correlate each request /response .
Format.
*
Its canonical textual representation,
* the 16 octets of a UUID are represented as
* 32 hexadecimal (base-16) digits, displayed
* in five groups separated by hyphens, in the
* form 8-4-4-4-12 for a total of 36 characters
* (32 hexadecimal characters and 4 hyphens)
*
* @param evseStatus Filter by Locations that have the given
* status
* @param connectorTypes Filter by Locations that have Connectors
* with the set of Connector Types
* @param connectorMinPower Filter by Locations that have a Connector
* with at least this power output (in kW)
* @param authorizationMethods Filter by Locations that support the given
* Authorization Methods
* @param withOperatorName Return operator name in marker response
* object
* @param evseId optional Standard EVSE (Electric Vehicle
* Supply Equipment) Id identifier (ISO-IEC-
* 15118)
* @param locationExternalId Filter by Locations with the given
* externalId. (Unique Location externalID
* provided by Shell Recharge)
* @param evseExternalId Filter by Locations that have an Evse with
* the given External Id. (Unique individual
* EVSE externalID provided by Shell Recharge)
* @param pageNumber Restrict the response list by providing a
* specific set of page Number. Set perPage
* parameter also when page Number is used.
* @param perPage Restrict the number of sites in response
* per page.
* @param updatedSince ZonedDateTime as string
* @param country Filter by Locations that are at least in
* one of the given countries (specified using
* ISO 3166-1 alpha-3 codes)
* @param excludeCountry Filter by Locations that are not in one of
* the given countries (specified using ISO
* 3166-1 alpha-3 codes)
* @return Response from the API call
*/
async getEVLocations(
requestId: string,
evseStatus?: GetEVLocationsEvseStatusEnum,
connectorTypes?: GetEVLocationsConnectorTypesEnum,
connectorMinPower?: number,
authorizationMethods?: GetEVLocationsAuthorizationMethodsEnum,
withOperatorName?: boolean,
evseId?: string,
locationExternalId?: string,
evseExternalId?: string,
pageNumber?: number,
perPage?: number,
updatedSince?: string,
country?: string[],
excludeCountry?: string[],
requestOptions?: RequestOptions
): Promise> {
const req = this.createRequest('GET', '/locations');
const mapped = req.prepareArgs({
requestId: [requestId, string()],
evseStatus: [evseStatus, optional(getEVLocationsEvseStatusEnumSchema)],
connectorTypes: [
connectorTypes,
optional(getEVLocationsConnectorTypesEnumSchema),
],
connectorMinPower: [connectorMinPower, optional(number())],
authorizationMethods: [
authorizationMethods,
optional(getEVLocationsAuthorizationMethodsEnumSchema),
],
withOperatorName: [withOperatorName, optional(boolean())],
evseId: [evseId, optional(string())],
locationExternalId: [locationExternalId, optional(string())],
evseExternalId: [evseExternalId, optional(string())],
pageNumber: [pageNumber, optional(number())],
perPage: [perPage, optional(number())],
updatedSince: [updatedSince, optional(string())],
country: [country, optional(array(string()))],
excludeCountry: [excludeCountry, optional(array(string()))],
});
req.header('RequestId', mapped.requestId);
req.query('evseStatus', mapped.evseStatus);
req.query('connectorTypes', mapped.connectorTypes);
req.query('connectorMinPower', mapped.connectorMinPower);
req.query('authorizationMethods', mapped.authorizationMethods);
req.query('withOperatorName', mapped.withOperatorName);
req.query('evseId', mapped.evseId);
req.query('locationExternalId', mapped.locationExternalId);
req.query('evseExternalId', mapped.evseExternalId);
req.query('pageNumber', mapped.pageNumber);
req.query('perPage', mapped.perPage);
req.query('updatedSince', mapped.updatedSince);
req.query('country', mapped.country);
req.query('excludeCountry', mapped.excludeCountry);
req.throwOn(
400,
BadRequestError,
'The server cannot or will not process the request due to something that is perceived to be a client error (e.g., malformed request syntax, invalid request message framing, or deceptive request routing).'
);
req.throwOn(
401,
UnauthorizedError,
'The request has not been applied because it lacks valid authentication credentials for the target resource.'
);
req.throwOn(404, NotFoundError, 'Location Not Found');
req.throwOn(
429,
TooManyRequestsError,
'The Request reached maximum allocated rate limit'
);
req.throwOn(500, InternalServerError, 'Internal Server error');
req.throwOn(503, ServiceunavailableError, 'Service unavailable');
req.authenticate([{ bearerAuth: true }]);
return req.callAsJson(responseSchema, requestOptions);
}
/**
* This API provides the details on a single Shell Recharge location.
* The query for a single location is to be made using the Unique Internal identifier used to refer to
* this Location by Shell Recharge. (Uid from List of locations API)
*
* @param requestId RequestId must be unique identifier value that can be used by the consumer to
* correlate each request /response .
Format.
Its canonical textual representation,
* the 16 octets of a UUID are represented as 32 hexadecimal (base-16) digits, displayed
* in five groups separated by hyphens, in the form 8-4-4-4-12 for a total of 36
* characters (32 hexadecimal characters and 4 hyphens)
* @param id Unique Uid of the location from List of locations API
* @param providerId The provider id that you wish to see locations and tariffs for
* @param since to get the locations modified after a date
* @return Response from the API call
*/
async evLocationsByID(
requestId: string,
id: string,
providerId?: string,
since?: string,
requestOptions?: RequestOptions
): Promise> {
const req = this.createRequest('GET');
const mapped = req.prepareArgs({
requestId: [requestId, string()],
id: [id, string()],
providerId: [providerId, optional(string())],
since: [since, optional(string())],
});
req.header('RequestId', mapped.requestId);
req.query('providerId', mapped.providerId);
req.query('since', mapped.since);
req.appendTemplatePath`/locations/${mapped.id}`;
req.throwOn(
400,
BadRequestError,
'The server cannot or will not process the request due to something that is perceived to be a client error (e.g., malformed request syntax, invalid request message framing, or deceptive request routing).'
);
req.throwOn(
401,
UnauthorizedError,
'The request has not been applied because it lacks valid authentication credentials for the target resource.'
);
req.throwOn(404, NotFoundError, 'Location Not Found');
req.throwOn(
429,
TooManyRequestsError,
'The Request reached maximum allocated rate limit'
);
req.throwOn(500, InternalServerError, 'Internal Server error');
req.throwOn(503, ServiceunavailableError, 'Service unavailable');
req.authenticate([{ bearerAuth: true }]);
return req.callAsJson(responseSchema, requestOptions);
}
/**
* This API provides the list of all nearby Shell Recharge locations based on the latitude and
* longitude provided in the request.
* The list includes all Shell Recharge network and all sites available through our roaming partners.
* The end point provides the details such as the exact location/address of the site along with the up-
* to-date status information of all the charging units in the site.
*
* Supported Search Options
*
* * Based on latitude and longitude of the location. (Mandatory)
* * Based on status of the Charging units. Eg : Available or Occupied
* * Based on available connector types.
* * Based on minimum Power output (in kW) available
*
* @param requestId RequestId must be unique identifier value
* that can be used by the consumer to
* correlate each request /response .
Format.
*
Its canonical textual representation,
* the 16 octets of a UUID are represented as
* 32 hexadecimal (base-16) digits, displayed
* in five groups separated by hyphens, in the
* form 8-4-4-4-12 for a total of 36 characters
* (32 hexadecimal characters and 4 hyphens)
*
* @param latitude Latitude to get Shell Recharge Locations
* nearby
* @param longitude Longitude to get Shell Recharge Locations
* nearby
* @param limit Maximum number of Locations to retrieve
* @param locationExternalId Filter by Locations with the given
* externalId Identifier as given by the Shell
* Recharge Operator, unique for that Operator
* @param evseId Filter by Locations that have an Evse with
* the given Evse Id
* @param evseExternalId Filter by Locations that have an Evse with
* the given External Id Identifier of the Evse
* as given by the Operator, unique for that
* Operator
* @param operatorName Filter by Locations that have the given
* operator
* @param evseStatus Filter by Locations that have the given
* status
* @param connectorTypes Filter by Locations that have Connectors
* with these Connector Types
* @param connectorMinPower Filter by Locations that have a Connector
* with at least this power output (in kW)
* @param authorizationMethods Filter by Locations that support the given
* Authorization Methods
* @param withOperatorName Return operator name in marker object (only
* for marker type Single ChargePoint)
* @param withMaxPower Return maximum power in kW across all
* locations grouped in this marker
* (disregarding availability)
* @param country Filter by Locations that are at least in
* one of the given countries (specified using
* ISO 3166-1 alpha-3 codes)
* @param excludeCountry Filter by Locations that are not in one of
* the given countries (specified using ISO
* 3166-1 alpha-3 codes)
* @return Response from the API call
*/
async nearbyLocations(
requestId: string,
latitude: number,
longitude: number,
limit?: number,
locationExternalId?: string,
evseId?: string,
evseExternalId?: string,
operatorName?: string,
evseStatus?: GetEVLocationsEvseStatusEnum,
connectorTypes?: NearbyLocationsConnectorTypesEnum,
connectorMinPower?: number,
authorizationMethods?: GetEVLocationsAuthorizationMethodsEnum,
withOperatorName?: boolean,
withMaxPower?: boolean,
country?: string[],
excludeCountry?: string[],
requestOptions?: RequestOptions
): Promise> {
const req = this.createRequest('GET', '/locations/nearby');
const mapped = req.prepareArgs({
requestId: [requestId, string()],
latitude: [latitude, number()],
longitude: [longitude, number()],
limit: [limit, optional(number())],
locationExternalId: [locationExternalId, optional(string())],
evseId: [evseId, optional(string())],
evseExternalId: [evseExternalId, optional(string())],
operatorName: [operatorName, optional(string())],
evseStatus: [evseStatus, optional(getEVLocationsEvseStatusEnumSchema)],
connectorTypes: [
connectorTypes,
optional(nearbyLocationsConnectorTypesEnumSchema),
],
connectorMinPower: [connectorMinPower, optional(number())],
authorizationMethods: [
authorizationMethods,
optional(getEVLocationsAuthorizationMethodsEnumSchema),
],
withOperatorName: [withOperatorName, optional(boolean())],
withMaxPower: [withMaxPower, optional(boolean())],
country: [country, optional(array(string()))],
excludeCountry: [excludeCountry, optional(array(string()))],
});
req.header('RequestId', mapped.requestId);
req.query('latitude', mapped.latitude);
req.query('longitude', mapped.longitude);
req.query('limit', mapped.limit);
req.query('locationExternalId', mapped.locationExternalId);
req.query('evseId', mapped.evseId);
req.query('evseExternalId', mapped.evseExternalId);
req.query('operatorName', mapped.operatorName);
req.query('evseStatus', mapped.evseStatus);
req.query('connectorTypes', mapped.connectorTypes);
req.query('connectorMinPower', mapped.connectorMinPower);
req.query('authorizationMethods', mapped.authorizationMethods);
req.query('withOperatorName', mapped.withOperatorName);
req.query('withMaxPower', mapped.withMaxPower);
req.query('country', mapped.country);
req.query('excludeCountry', mapped.excludeCountry);
req.throwOn(
400,
BadRequestError,
'The server cannot or will not process the request due to something that is perceived to be a client error (e.g., malformed request syntax, invalid request message framing, or deceptive request routing).'
);
req.throwOn(
401,
UnauthorizedError,
'The request has not been applied because it lacks valid authentication credentials for the target resource.'
);
req.throwOn(404, NotFoundError, 'Location Not Found');
req.throwOn(
429,
TooManyRequestsError,
'The Request reached maximum allocated rate limit'
);
req.throwOn(500, InternalServerError, 'Internal Server error');
req.throwOn(503, ServiceunavailableError, 'Service unavailable');
req.authenticate([{ bearerAuth: true }]);
return req.callAsJson(responseSchema, requestOptions);
}
/**
* This API, when given a set of bounds on the geographical front (East,West, North, South) will return
* a set of Markers that fall within the requested bounds. The API will automatically group locations
* at the same position on the map into one Marker.
*
* The API also provide further search options to filter the result set.
*
* * Based on status of the Charging units. Eg : Available or Occupied
* * Based on available connector types.
* * Based on minimum Power output (in kW) available
*
* @param requestId RequestId must be unique identifier value
* that can be used by the consumer to
* correlate each request /response .
Format.
*
Its canonical textual representation,
* the 16 octets of a UUID are represented as
* 32 hexadecimal (base-16) digits, displayed
* in five groups separated by hyphens, in the
* form 8-4-4-4-12 for a total of 36 characters
* (32 hexadecimal characters and 4 hyphens)
*
* @param west Longitude of the western bound to get the
* Shell Recharge Locations
* @param south Latitude of the southern bound to get the
* Shell Recharge Locations
* @param east Longitude of the eastern bound to get the
* Shell Recharge Locations
* @param north Latitude of the northern bound to get the
* Shell Recharge Locations
* @param zoom Zoom level to show ex: (1: World, 5:
* Landmass/continent, 10: City, 15: Streets,
* 20: Buildings)
* @param evseStatus Filter by Locations that have the given
* status
* @param connectorTypes Filter by Locations that have Connectors
* with the set of Connector Types
* @param connectorMinPower Filter by Locations that have a Connector
* with at least this power output (in kW)
* @param authorizationMethods Filter by Locations that support the given
* Authorization Methods
* @param withOperatorName Return operator name in marker object (only
* for marker type SingleChargePoint)
* @param withMaxPower Return maximum power in kW across all
* locations grouped in this marker
* (disregarding availability)
* @param locationExternalId Filter by Locations with the given
* externalId. (Unique Location externalID
* provided by Shell Recharge)
* @param evseId Filter by Locations that have an Evse with
* the given Evse Id
* @param evseExternalId Filter by Locations that have an Evse with
* the given External Id Identifier of the Evse
* as given by the Operator, unique for that
* Operator
* @param operatorName Filter by Locations that have the given
* operator
* @param country Filter by Locations that are at least in
* one of the given countries (specified using
* ISO 3166-1 alpha-3 codes)
* @param excludeCountry Filter by Locations that are not in one of
* the given countries (specified using ISO
* 3166-1 alpha-3 codes)
* @return Response from the API call
*/
async locationsMarkers(
requestId: string,
west: number,
south: number,
east: number,
north: number,
zoom: string,
evseStatus?: GetEVLocationsEvseStatusEnum,
connectorTypes?: GetEVLocationsConnectorTypesEnum,
connectorMinPower?: number,
authorizationMethods?: GetEVLocationsAuthorizationMethodsEnum,
withOperatorName?: boolean,
withMaxPower?: boolean,
locationExternalId?: string,
evseId?: string,
evseExternalId?: string,
operatorName?: string,
country?: string[],
excludeCountry?: string[],
requestOptions?: RequestOptions
): Promise> {
const req = this.createRequest('GET', '/locations/markers');
const mapped = req.prepareArgs({
requestId: [requestId, string()],
west: [west, number()],
south: [south, number()],
east: [east, number()],
north: [north, number()],
zoom: [zoom, string()],
evseStatus: [evseStatus, optional(getEVLocationsEvseStatusEnumSchema)],
connectorTypes: [
connectorTypes,
optional(getEVLocationsConnectorTypesEnumSchema),
],
connectorMinPower: [connectorMinPower, optional(number())],
authorizationMethods: [
authorizationMethods,
optional(getEVLocationsAuthorizationMethodsEnumSchema),
],
withOperatorName: [withOperatorName, optional(boolean())],
withMaxPower: [withMaxPower, optional(boolean())],
locationExternalId: [locationExternalId, optional(string())],
evseId: [evseId, optional(string())],
evseExternalId: [evseExternalId, optional(string())],
operatorName: [operatorName, optional(string())],
country: [country, optional(array(string()))],
excludeCountry: [excludeCountry, optional(array(string()))],
});
req.header('RequestId', mapped.requestId);
req.query('west', mapped.west);
req.query('south', mapped.south);
req.query('east', mapped.east);
req.query('north', mapped.north);
req.query('zoom', mapped.zoom);
req.query('evseStatus', mapped.evseStatus);
req.query('connectorTypes', mapped.connectorTypes);
req.query('connectorMinPower', mapped.connectorMinPower);
req.query('authorizationMethods', mapped.authorizationMethods);
req.query('withOperatorName', mapped.withOperatorName);
req.query('withMaxPower', mapped.withMaxPower);
req.query('locationExternalId', mapped.locationExternalId);
req.query('evseId', mapped.evseId);
req.query('evseExternalId', mapped.evseExternalId);
req.query('operatorName', mapped.operatorName);
req.query('country', mapped.country);
req.query('excludeCountry', mapped.excludeCountry);
req.throwOn(
400,
BadRequestError,
'The server cannot or will not process the request due to something that is perceived to be a client error (e.g., malformed request syntax, invalid request message framing, or deceptive request routing).'
);
req.throwOn(
401,
UnauthorizedError,
'The request has not been applied because it lacks valid authentication credentials for the target resource.'
);
req.throwOn(404, NotFoundError, 'Location Not Found');
req.throwOn(
429,
TooManyRequestsError,
'The Request reached maximum allocated rate limit'
);
req.throwOn(500, InternalServerError, 'Internal server error');
req.throwOn(503, ServiceunavailableError, 'Service unavailable');
req.authenticate([{ bearerAuth: true }]);
return req.callAsJson(singleLocationMarkerResponseSchema, requestOptions);
}
}