import { I as Identifier } from './Token-ba2c5d5c.js';
import { M as Merchant$1 } from './index-c2c33860.js';
import { a as Connection } from './Item-f4cbd6f4.js';
import './ok-c9833bf3.js';
import './index-714bb39b.js';
import './index-063af7ee.js';
import './TextDecoder-357ac2ce.js';
import './_commonjsHelpers-9943807e.js';
import './index-1f953d81.js';

class Merchant {
    constructor(connection) {
        this.connection = connection;
    }
    async create(request) {
        return await this.connection.post("merchant", request);
    }
    async list() {
        return this.connection.get("merchant");
    }
    async change(request, id) {
        return await this.connection.patch("merchant/" + (Identifier.is(id) ? id : ""), request);
    }
    async load(id) {
        return !id
            ? await this.connection.get("merchant")
            : Identifier.is(id)
                ? await this.connection.get("merchant/" + id)
                : (await Promise.all(id.map(i => this.connection.get("merchant/" + i)))).filter(Merchant$1.is);
    }
    static open(url, token) {
        const connection = Connection.open(url, token);
        return connection && new Merchant(connection);
    }
}

export { Merchant };
