@commercelayer/sdk
Version:
Commerce Layer Javascript SDK
58 lines (55 loc) • 2.62 kB
JavaScript
;
var chunkU22VLCMN_cjs = require('./chunk-U22VLCMN.cjs');
// src/resources/vertex_accounts.ts
var VertexAccounts = class _VertexAccounts extends chunkU22VLCMN_cjs.ApiResource {
static TYPE = "vertex_accounts";
async create(resource, params, options) {
return this.resources.create({ ...resource, type: _VertexAccounts.TYPE }, params, options);
}
async update(resource, params, options) {
return this.resources.update({ ...resource, type: _VertexAccounts.TYPE }, params, options);
}
async delete(id, options) {
await this.resources.delete(typeof id === "string" ? { id, type: _VertexAccounts.TYPE } : id, options);
}
async markets(vertexAccountId, params, options) {
const _vertexAccountId = vertexAccountId.id || vertexAccountId;
return this.resources.fetch({ type: "markets" }, `vertex_accounts/${_vertexAccountId}/markets`, params, options);
}
async attachments(vertexAccountId, params, options) {
const _vertexAccountId = vertexAccountId.id || vertexAccountId;
return this.resources.fetch({ type: "attachments" }, `vertex_accounts/${_vertexAccountId}/attachments`, params, options);
}
async events(vertexAccountId, params, options) {
const _vertexAccountId = vertexAccountId.id || vertexAccountId;
return this.resources.fetch({ type: "events" }, `vertex_accounts/${_vertexAccountId}/events`, params, options);
}
async versions(vertexAccountId, params, options) {
const _vertexAccountId = vertexAccountId.id || vertexAccountId;
return this.resources.fetch({ type: "versions" }, `vertex_accounts/${_vertexAccountId}/versions`, params, options);
}
async event_stores(vertexAccountId, params, options) {
const _vertexAccountId = vertexAccountId.id || vertexAccountId;
return this.resources.fetch({ type: "event_stores" }, `vertex_accounts/${_vertexAccountId}/event_stores`, params, options);
}
async _refresh_token(id, params, options) {
return this.resources.update({ id: typeof id === "string" ? id : id.id, type: _VertexAccounts.TYPE, _refresh_token: true }, params, options);
}
isVertexAccount(resource) {
return resource.type && resource.type === _VertexAccounts.TYPE;
}
relationship(id) {
return super.relationshipOneToOne(id);
}
relationshipToMany(...ids) {
return super.relationshipOneToMany(...ids);
}
type() {
return _VertexAccounts.TYPE;
}
};
var instance = new VertexAccounts();
var vertex_accounts_default = instance;
exports.vertex_accounts_default = vertex_accounts_default;
//# sourceMappingURL=chunk-K7AR7Z3J.cjs.map
//# sourceMappingURL=chunk-K7AR7Z3J.cjs.map