import { ApiResponse , RequestOptions } from '../core' ; import { ListCustomerSegmentsResponse , listCustomerSegmentsResponseSchema , } from '../models/listCustomerSegmentsResponse' ; import { RetrieveCustomerSegmentResponse , retrieveCustomerSegmentResponseSchema , } from '../models/retrieveCustomerSegmentResponse' ; import { number , optional , string } from '../schema' ; import { BaseApi } from './baseApi' ; export class CustomerSegmentsApi extends BaseApi { param cursor param limit return async listCustomerSegments ( cursor ? , limit ? , requestOptions ? ) { const req = this . createRequest ( 'GET' , '/v2/customers/segments' ) ; const mapped = req . prepareArgs ( { cursor : [ cursor , optional ( string ( ) ) ] , limit : [ limit , optional ( number ( ) ) ] , } ) ; req . query ( 'cursor' , mapped . cursor ) ; req . query ( 'limit' , mapped . limit ) ; return req . callAsJson ( listCustomerSegmentsResponseSchema , requestOptions ) ; } param segmentId return async retrieveCustomerSegment ( segmentId , requestOptions ? ) { const req = this . createRequest ( 'GET' ) ; const mapped = req . prepareArgs ( { segmentId : [ segmentId , string ( ) ] } ) ; req . appendTemplatePath `/v2/customers/segments/${ mapped . segmentId }` ; return req . callAsJson ( retrieveCustomerSegmentResponseSchema , requestOptions ) ; } }