/** * Shell EVLib * * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ). */ import { ApiResponse, RequestOptions } from '../core'; import { ActiveResponse200Json, activeResponse200JsonSchema, } from '../models/activeResponse200Json'; import { ChargesessionStartBody, chargesessionStartBodySchema, } from '../models/chargesessionStartBody'; import { GetChargeSessionRetrieveResponse200Json, getChargeSessionRetrieveResponse200JsonSchema, } from '../models/getChargeSessionRetrieveResponse200Json'; import { InlineResponse202, inlineResponse202Schema, } from '../models/inlineResponse202'; import { InlineResponse2021, inlineResponse2021Schema, } from '../models/inlineResponse2021'; import { 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 ChargingController extends BaseController { /** * This endpoint start the charging session for the user. * * @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 body * @return Response from the API call */ async start( requestId: string, body?: ChargesessionStartBody, requestOptions?: RequestOptions ): Promise> { const req = this.createRequest('POST', '/charge-session/start'); const mapped = req.prepareArgs({ requestId: [requestId, string()], body: [body, optional(chargesessionStartBodySchema)], }); req.header('RequestId', mapped.requestId); req.header('Content-Type', 'application/json'); req.json(mapped.body); 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(inlineResponse202Schema, requestOptions); } /** * Accepts a request to stop an active session when a valid session id is provided. * * @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 sessionId Session Id * @return Response from the API call */ async stop( requestId: string, sessionId: string, requestOptions?: RequestOptions ): Promise> { const req = this.createRequest('POST', '/charge-session/stop'); const mapped = req.prepareArgs({ requestId: [requestId, string()], sessionId: [sessionId, string()], }); req.header('RequestId', mapped.requestId); req.query('sessionId', mapped.sessionId); 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(inlineResponse2021Schema, requestOptions); } /** * This endpoint returns the details of the session if the session is found. * * @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 sessionId Session Id * @return Response from the API call */ async getChargeSessionRetrieve( requestId: string, sessionId: string, requestOptions?: RequestOptions ): Promise> { const req = this.createRequest('GET', '/charge-session/retrieve'); const mapped = req.prepareArgs({ requestId: [requestId, string()], sessionId: [sessionId, string()], }); req.header('RequestId', mapped.requestId); req.query('sessionId', mapped.sessionId); 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( getChargeSessionRetrieveResponse200JsonSchema, requestOptions ); } /** * Fetrches the active sessions for user. * * @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 emaId Emobility Account Identifier(Ema-ID) * @return Response from the API call */ async active( requestId: string, emaId: string, requestOptions?: RequestOptions ): Promise> { const req = this.createRequest('GET', '/charge-session/active'); const mapped = req.prepareArgs({ requestId: [requestId, string()], emaId: [emaId, string()], }); req.header('RequestId', mapped.requestId); req.query('emaId', mapped.emaId); req.authenticate([{ bearerAuth: true }]); return req.callAsJson(activeResponse200JsonSchema, requestOptions); } }