import * as gracely from "gracely" import { Connection } from "@payfunc/model-base" import { Functions as ModelFunctions } from "../Functions" export class Functions { constructor(readonly connection: Connection) {} async create(request: ModelFunctions): Promise { return await this.connection.post("merchant/functions", request) } async list(): Promise { return this.connection.get("merchant/functions") } async change(request: ModelFunctions): Promise { return await this.connection.put("merchant/functions", request) } static open(url: string, token: string): Functions static open(url: string | undefined, token: string | undefined): Functions | undefined static open(url: string | undefined, token: string | undefined): Functions | undefined { const connection = Connection.open(url, token) return connection && new Functions(connection) } }