import * as gracely from "gracely" import { Connection } from "@payfunc/model-base" export class Dispute { constructor(readonly connection: Connection) {} async getSilverflowToken(type: "test" | "live"): Promise { const result = await this.connection.post<{ key: string; token: string } | gracely.Error>( `dispute/silverflow/token/${type}`, undefined ) return "token" in result ? result.token : result } static open(url: string, token: string): Dispute static open(url: string | undefined, token: string | undefined): Dispute | undefined static open(url: string | undefined, token: string | undefined): Dispute | undefined { const connection = Connection.open(url, token) return connection && new Dispute(connection) } }