import { ApiResponse , RequestOptions } from '../core' ; import { CreateLocationRequest , createLocationRequestSchema , } from '../models/createLocationRequest' ; import { CreateLocationResponse , createLocationResponseSchema , } from '../models/createLocationResponse' ; import { ListLocationsResponse , listLocationsResponseSchema , } from '../models/listLocationsResponse' ; import { RetrieveLocationResponse , retrieveLocationResponseSchema , } from '../models/retrieveLocationResponse' ; import { UpdateLocationRequest , updateLocationRequestSchema , } from '../models/updateLocationRequest' ; import { UpdateLocationResponse , updateLocationResponseSchema , } from '../models/updateLocationResponse' ; import { string } from '../schema' ; import { BaseApi } from './baseApi' ; export class LocationsApi extends BaseApi { return async listLocations ( requestOptions ? ) { const req = this . createRequest ( 'GET' , '/v2/locations' ) ; return req . callAsJson ( listLocationsResponseSchema , requestOptions ) ; } param body return async createLocation ( body , requestOptions ? ) { const req = this . createRequest ( 'POST' , '/v2/locations' ) ; const mapped = req . prepareArgs ( { body : [ body , createLocationRequestSchema ] , } ) ; req . header ( 'Content-Type' , 'application/json' ) ; req . json ( mapped . body ) ; return req . callAsJson ( createLocationResponseSchema , requestOptions ) ; } param locationId return async retrieveLocation ( locationId , requestOptions ? ) { const req = this . createRequest ( 'GET' ) ; const mapped = req . prepareArgs ( { locationId : [ locationId , string ( ) ] } ) ; req . appendTemplatePath `/v2/locations/${ mapped . locationId }` ; return req . callAsJson ( retrieveLocationResponseSchema , requestOptions ) ; } param locationId param body return async updateLocation ( locationId , body , requestOptions ? ) { const req = this . createRequest ( 'PUT' ) ; const mapped = req . prepareArgs ( { locationId : [ locationId , string ( ) ] , body : [ body , updateLocationRequestSchema ] , } ) ; req . header ( 'Content-Type' , 'application/json' ) ; req . json ( mapped . body ) ; req . appendTemplatePath `/v2/locations/${ mapped . locationId }` ; return req . callAsJson ( updateLocationResponseSchema , requestOptions ) ; } }