import { ApiResponse , RequestOptions } from '../core' ; import { CreateGiftCardActivityRequest , createGiftCardActivityRequestSchema , } from '../models/createGiftCardActivityRequest' ; import { CreateGiftCardActivityResponse , createGiftCardActivityResponseSchema , } from '../models/createGiftCardActivityResponse' ; import { ListGiftCardActivitiesResponse , listGiftCardActivitiesResponseSchema , } from '../models/listGiftCardActivitiesResponse' ; import { number , optional , string } from '../schema' ; import { BaseApi } from './baseApi' ; export class GiftCardActivitiesApi extends BaseApi { param giftCardId param type param locationId param beginTime param endTime param limit param cursor param sortOrder return async listGiftCardActivities ( giftCardId ? , type ? , locationId ? , beginTime ? , endTime ? , limit ? , cursor ? , sortOrder ? , requestOptions ? ) { const req = this . createRequest ( 'GET' , '/v2/gift-cards/activities' ) ; const mapped = req . prepareArgs ( { giftCardId : [ giftCardId , optional ( string ( ) ) ] , type : [ type , optional ( string ( ) ) ] , locationId : [ locationId , optional ( string ( ) ) ] , beginTime : [ beginTime , optional ( string ( ) ) ] , endTime : [ endTime , optional ( string ( ) ) ] , limit : [ limit , optional ( number ( ) ) ] , cursor : [ cursor , optional ( string ( ) ) ] , sortOrder : [ sortOrder , optional ( string ( ) ) ] , } ) ; req . query ( 'gift_card_id' , mapped . giftCardId ) ; req . query ( 'type' , mapped . type ) ; req . query ( 'location_id' , mapped . locationId ) ; req . query ( 'begin_time' , mapped . beginTime ) ; req . query ( 'end_time' , mapped . endTime ) ; req . query ( 'limit' , mapped . limit ) ; req . query ( 'cursor' , mapped . cursor ) ; req . query ( 'sort_order' , mapped . sortOrder ) ; return req . callAsJson ( listGiftCardActivitiesResponseSchema , requestOptions ) ; } param body return async createGiftCardActivity ( body , requestOptions ? ) { const req = this . createRequest ( 'POST' , '/v2/gift-cards/activities' ) ; const mapped = req . prepareArgs ( { body : [ body , createGiftCardActivityRequestSchema ] , } ) ; req . header ( 'Content-Type' , 'application/json' ) ; req . json ( mapped . body ) ; return req . callAsJson ( createGiftCardActivityResponseSchema , requestOptions ) ; } }