import { ApiResponse , RequestOptions } from '../core' ; import { AccumulateLoyaltyPointsRequest , accumulateLoyaltyPointsRequestSchema , } from '../models/accumulateLoyaltyPointsRequest' ; import { AccumulateLoyaltyPointsResponse , accumulateLoyaltyPointsResponseSchema , } from '../models/accumulateLoyaltyPointsResponse' ; import { AdjustLoyaltyPointsRequest , adjustLoyaltyPointsRequestSchema , } from '../models/adjustLoyaltyPointsRequest' ; import { AdjustLoyaltyPointsResponse , adjustLoyaltyPointsResponseSchema , } from '../models/adjustLoyaltyPointsResponse' ; import { CalculateLoyaltyPointsRequest , calculateLoyaltyPointsRequestSchema , } from '../models/calculateLoyaltyPointsRequest' ; import { CalculateLoyaltyPointsResponse , calculateLoyaltyPointsResponseSchema , } from '../models/calculateLoyaltyPointsResponse' ; import { CreateLoyaltyAccountRequest , createLoyaltyAccountRequestSchema , } from '../models/createLoyaltyAccountRequest' ; import { CreateLoyaltyAccountResponse , createLoyaltyAccountResponseSchema , } from '../models/createLoyaltyAccountResponse' ; import { CreateLoyaltyRewardRequest , createLoyaltyRewardRequestSchema , } from '../models/createLoyaltyRewardRequest' ; import { CreateLoyaltyRewardResponse , createLoyaltyRewardResponseSchema , } from '../models/createLoyaltyRewardResponse' ; import { DeleteLoyaltyRewardResponse , deleteLoyaltyRewardResponseSchema , } from '../models/deleteLoyaltyRewardResponse' ; import { ListLoyaltyProgramsResponse , listLoyaltyProgramsResponseSchema , } from '../models/listLoyaltyProgramsResponse' ; import { RedeemLoyaltyRewardRequest , redeemLoyaltyRewardRequestSchema , } from '../models/redeemLoyaltyRewardRequest' ; import { RedeemLoyaltyRewardResponse , redeemLoyaltyRewardResponseSchema , } from '../models/redeemLoyaltyRewardResponse' ; import { RetrieveLoyaltyAccountResponse , retrieveLoyaltyAccountResponseSchema , } from '../models/retrieveLoyaltyAccountResponse' ; import { RetrieveLoyaltyProgramResponse , retrieveLoyaltyProgramResponseSchema , } from '../models/retrieveLoyaltyProgramResponse' ; import { RetrieveLoyaltyRewardResponse , retrieveLoyaltyRewardResponseSchema , } from '../models/retrieveLoyaltyRewardResponse' ; import { SearchLoyaltyAccountsRequest , searchLoyaltyAccountsRequestSchema , } from '../models/searchLoyaltyAccountsRequest' ; import { SearchLoyaltyAccountsResponse , searchLoyaltyAccountsResponseSchema , } from '../models/searchLoyaltyAccountsResponse' ; import { SearchLoyaltyEventsRequest , searchLoyaltyEventsRequestSchema , } from '../models/searchLoyaltyEventsRequest' ; import { SearchLoyaltyEventsResponse , searchLoyaltyEventsResponseSchema , } from '../models/searchLoyaltyEventsResponse' ; import { SearchLoyaltyRewardsRequest , searchLoyaltyRewardsRequestSchema , } from '../models/searchLoyaltyRewardsRequest' ; import { SearchLoyaltyRewardsResponse , searchLoyaltyRewardsResponseSchema , } from '../models/searchLoyaltyRewardsResponse' ; import { string } from '../schema' ; import { BaseApi } from './baseApi' ; export class LoyaltyApi extends BaseApi { param body return async createLoyaltyAccount ( body , requestOptions ? ) { const req = this . createRequest ( 'POST' , '/v2/loyalty/accounts' ) ; const mapped = req . prepareArgs ( { body : [ body , createLoyaltyAccountRequestSchema ] , } ) ; req . header ( 'Content-Type' , 'application/json' ) ; req . json ( mapped . body ) ; return req . callAsJson ( createLoyaltyAccountResponseSchema , requestOptions ) ; } param body return async searchLoyaltyAccounts ( body , requestOptions ? ) { const req = this . createRequest ( 'POST' , '/v2/loyalty/accounts/search' ) ; const mapped = req . prepareArgs ( { body : [ body , searchLoyaltyAccountsRequestSchema ] , } ) ; req . header ( 'Content-Type' , 'application/json' ) ; req . json ( mapped . body ) ; return req . callAsJson ( searchLoyaltyAccountsResponseSchema , requestOptions ) ; } param accountId return async retrieveLoyaltyAccount ( accountId , requestOptions ? ) { const req = this . createRequest ( 'GET' ) ; const mapped = req . prepareArgs ( { accountId : [ accountId , string ( ) ] } ) ; req . appendTemplatePath `/v2/loyalty/accounts/${ mapped . accountId }` ; return req . callAsJson ( retrieveLoyaltyAccountResponseSchema , requestOptions ) ; } param accountId param body return async accumulateLoyaltyPoints ( accountId , body , requestOptions ? ) { const req = this . createRequest ( 'POST' ) ; const mapped = req . prepareArgs ( { accountId : [ accountId , string ( ) ] , body : [ body , accumulateLoyaltyPointsRequestSchema ] , } ) ; req . header ( 'Content-Type' , 'application/json' ) ; req . json ( mapped . body ) ; req . appendTemplatePath `/v2/loyalty/accounts/${ mapped . accountId }/accumulate` ; return req . callAsJson ( accumulateLoyaltyPointsResponseSchema , requestOptions ) ; } param accountId param body return async adjustLoyaltyPoints ( accountId , body , requestOptions ? ) { const req = this . createRequest ( 'POST' ) ; const mapped = req . prepareArgs ( { accountId : [ accountId , string ( ) ] , body : [ body , adjustLoyaltyPointsRequestSchema ] , } ) ; req . header ( 'Content-Type' , 'application/json' ) ; req . json ( mapped . body ) ; req . appendTemplatePath `/v2/loyalty/accounts/${ mapped . accountId }/adjust` ; return req . callAsJson ( adjustLoyaltyPointsResponseSchema , requestOptions ) ; } param body return async searchLoyaltyEvents ( body , requestOptions ? ) { const req = this . createRequest ( 'POST' , '/v2/loyalty/events/search' ) ; const mapped = req . prepareArgs ( { body : [ body , searchLoyaltyEventsRequestSchema ] , } ) ; req . header ( 'Content-Type' , 'application/json' ) ; req . json ( mapped . body ) ; return req . callAsJson ( searchLoyaltyEventsResponseSchema , requestOptions ) ; } return deprecated async listLoyaltyPrograms ( requestOptions ? ) { const req = this . createRequest ( 'GET' , '/v2/loyalty/programs' ) ; req . deprecated ( 'LoyaltyApi.listLoyaltyPrograms' ) ; return req . callAsJson ( listLoyaltyProgramsResponseSchema , requestOptions ) ; } param programId return async retrieveLoyaltyProgram ( programId , requestOptions ? ) { const req = this . createRequest ( 'GET' ) ; const mapped = req . prepareArgs ( { programId : [ programId , string ( ) ] } ) ; req . appendTemplatePath `/v2/loyalty/programs/${ mapped . programId }` ; return req . callAsJson ( retrieveLoyaltyProgramResponseSchema , requestOptions ) ; } param programId param body return async calculateLoyaltyPoints ( programId , body , requestOptions ? ) { const req = this . createRequest ( 'POST' ) ; const mapped = req . prepareArgs ( { programId : [ programId , string ( ) ] , body : [ body , calculateLoyaltyPointsRequestSchema ] , } ) ; req . header ( 'Content-Type' , 'application/json' ) ; req . json ( mapped . body ) ; req . appendTemplatePath `/v2/loyalty/programs/${ mapped . programId }/calculate` ; return req . callAsJson ( calculateLoyaltyPointsResponseSchema , requestOptions ) ; } param body return async createLoyaltyReward ( body , requestOptions ? ) { const req = this . createRequest ( 'POST' , '/v2/loyalty/rewards' ) ; const mapped = req . prepareArgs ( { body : [ body , createLoyaltyRewardRequestSchema ] , } ) ; req . header ( 'Content-Type' , 'application/json' ) ; req . json ( mapped . body ) ; return req . callAsJson ( createLoyaltyRewardResponseSchema , requestOptions ) ; } param body return async searchLoyaltyRewards ( body , requestOptions ? ) { const req = this . createRequest ( 'POST' , '/v2/loyalty/rewards/search' ) ; const mapped = req . prepareArgs ( { body : [ body , searchLoyaltyRewardsRequestSchema ] , } ) ; req . header ( 'Content-Type' , 'application/json' ) ; req . json ( mapped . body ) ; return req . callAsJson ( searchLoyaltyRewardsResponseSchema , requestOptions ) ; } param rewardId return async deleteLoyaltyReward ( rewardId , requestOptions ? ) { const req = this . createRequest ( 'DELETE' ) ; const mapped = req . prepareArgs ( { rewardId : [ rewardId , string ( ) ] } ) ; req . appendTemplatePath `/v2/loyalty/rewards/${ mapped . rewardId }` ; return req . callAsJson ( deleteLoyaltyRewardResponseSchema , requestOptions ) ; } param rewardId return async retrieveLoyaltyReward ( rewardId , requestOptions ? ) { const req = this . createRequest ( 'GET' ) ; const mapped = req . prepareArgs ( { rewardId : [ rewardId , string ( ) ] } ) ; req . appendTemplatePath `/v2/loyalty/rewards/${ mapped . rewardId }` ; return req . callAsJson ( retrieveLoyaltyRewardResponseSchema , requestOptions ) ; } param rewardId param body return async redeemLoyaltyReward ( rewardId , body , requestOptions ? ) { const req = this . createRequest ( 'POST' ) ; const mapped = req . prepareArgs ( { rewardId : [ rewardId , string ( ) ] , body : [ body , redeemLoyaltyRewardRequestSchema ] , } ) ; req . header ( 'Content-Type' , 'application/json' ) ; req . json ( mapped . body ) ; req . appendTemplatePath `/v2/loyalty/rewards/${ mapped . rewardId }/redeem` ; return req . callAsJson ( redeemLoyaltyRewardResponseSchema , requestOptions ) ; } }