import { ApiResponse , FileWrapper , RequestOptions } from '../core' ; import { AcceptDisputeResponse , acceptDisputeResponseSchema , } from '../models/acceptDisputeResponse' ; import { CreateDisputeEvidenceFileRequest , createDisputeEvidenceFileRequestSchema , } from '../models/createDisputeEvidenceFileRequest' ; import { CreateDisputeEvidenceFileResponse , createDisputeEvidenceFileResponseSchema , } from '../models/createDisputeEvidenceFileResponse' ; import { CreateDisputeEvidenceTextRequest , createDisputeEvidenceTextRequestSchema , } from '../models/createDisputeEvidenceTextRequest' ; import { CreateDisputeEvidenceTextResponse , createDisputeEvidenceTextResponseSchema , } from '../models/createDisputeEvidenceTextResponse' ; import { DeleteDisputeEvidenceResponse , deleteDisputeEvidenceResponseSchema , } from '../models/deleteDisputeEvidenceResponse' ; import { ListDisputeEvidenceResponse , listDisputeEvidenceResponseSchema , } from '../models/listDisputeEvidenceResponse' ; import { ListDisputesResponse , listDisputesResponseSchema , } from '../models/listDisputesResponse' ; import { RetrieveDisputeEvidenceResponse , retrieveDisputeEvidenceResponseSchema , } from '../models/retrieveDisputeEvidenceResponse' ; import { RetrieveDisputeResponse , retrieveDisputeResponseSchema , } from '../models/retrieveDisputeResponse' ; import { SubmitEvidenceResponse , submitEvidenceResponseSchema , } from '../models/submitEvidenceResponse' ; import { optional , string } from '../schema' ; import { BaseApi } from './baseApi' ; export class DisputesApi extends BaseApi { param cursor param states param locationId return async listDisputes ( cursor ? , states ? , locationId ? , requestOptions ? ) { const req = this . createRequest ( 'GET' , '/v2/disputes' ) ; const mapped = req . prepareArgs ( { cursor : [ cursor , optional ( string ( ) ) ] , states : [ states , optional ( string ( ) ) ] , locationId : [ locationId , optional ( string ( ) ) ] , } ) ; req . query ( 'cursor' , mapped . cursor ) ; req . query ( 'states' , mapped . states ) ; req . query ( 'location_id' , mapped . locationId ) ; return req . callAsJson ( listDisputesResponseSchema , requestOptions ) ; } param disputeId return async retrieveDispute ( disputeId , requestOptions ? ) { const req = this . createRequest ( 'GET' ) ; const mapped = req . prepareArgs ( { disputeId : [ disputeId , string ( ) ] } ) ; req . appendTemplatePath `/v2/disputes/${ mapped . disputeId }` ; return req . callAsJson ( retrieveDisputeResponseSchema , requestOptions ) ; } param disputeId return async acceptDispute ( disputeId , requestOptions ? ) { const req = this . createRequest ( 'POST' ) ; const mapped = req . prepareArgs ( { disputeId : [ disputeId , string ( ) ] } ) ; req . appendTemplatePath `/v2/disputes/${ mapped . disputeId }/accept` ; return req . callAsJson ( acceptDisputeResponseSchema , requestOptions ) ; } param disputeId param cursor return async listDisputeEvidence ( disputeId , cursor ? , requestOptions ? ) { const req = this . createRequest ( 'GET' ) ; const mapped = req . prepareArgs ( { disputeId : [ disputeId , string ( ) ] , cursor : [ cursor , optional ( string ( ) ) ] , } ) ; req . query ( 'cursor' , mapped . cursor ) ; req . appendTemplatePath `/v2/disputes/${ mapped . disputeId }/evidence` ; return req . callAsJson ( listDisputeEvidenceResponseSchema , requestOptions ) ; } param disputeId param request param imageFile return async createDisputeEvidenceFile ( disputeId , request ? , imageFile ? , requestOptions ? ) { const req = this . createRequest ( 'POST' ) ; const mapped = req . prepareArgs ( { disputeId : [ disputeId , string ( ) ] , request : [ request , optional ( createDisputeEvidenceFileRequestSchema ) ] , } ) ; req . formData ( { request : JSON . stringify ( mapped . request ) , image_file : imageFile , } ) ; req . appendTemplatePath `/v2/disputes/${ mapped . disputeId }/evidence-files` ; return req . callAsJson ( createDisputeEvidenceFileResponseSchema , requestOptions ) ; } param disputeId param body return async createDisputeEvidenceText ( disputeId , body , requestOptions ? ) { const req = this . createRequest ( 'POST' ) ; const mapped = req . prepareArgs ( { disputeId : [ disputeId , string ( ) ] , body : [ body , createDisputeEvidenceTextRequestSchema ] , } ) ; req . header ( 'Content-Type' , 'application/json' ) ; req . json ( mapped . body ) ; req . appendTemplatePath `/v2/disputes/${ mapped . disputeId }/evidence-text` ; return req . callAsJson ( createDisputeEvidenceTextResponseSchema , requestOptions ) ; } param disputeId param evidenceId return async deleteDisputeEvidence ( disputeId , evidenceId , requestOptions ? ) { const req = this . createRequest ( 'DELETE' ) ; const mapped = req . prepareArgs ( { disputeId : [ disputeId , string ( ) ] , evidenceId : [ evidenceId , string ( ) ] , } ) ; req . appendTemplatePath `/v2/disputes/${ mapped . disputeId }/evidence/${ mapped . evidenceId }` ; return req . callAsJson ( deleteDisputeEvidenceResponseSchema , requestOptions ) ; } param disputeId param evidenceId return async retrieveDisputeEvidence ( disputeId , evidenceId , requestOptions ? ) { const req = this . createRequest ( 'GET' ) ; const mapped = req . prepareArgs ( { disputeId : [ disputeId , string ( ) ] , evidenceId : [ evidenceId , string ( ) ] , } ) ; req . appendTemplatePath `/v2/disputes/${ mapped . disputeId }/evidence/${ mapped . evidenceId }` ; return req . callAsJson ( retrieveDisputeEvidenceResponseSchema , requestOptions ) ; } param disputeId return async submitEvidence ( disputeId , requestOptions ? ) { const req = this . createRequest ( 'POST' ) ; const mapped = req . prepareArgs ( { disputeId : [ disputeId , string ( ) ] } ) ; req . appendTemplatePath `/v2/disputes/${ mapped . disputeId }/submit-evidence` ; return req . callAsJson ( submitEvidenceResponseSchema , requestOptions ) ; } }