shopify-admin-api
Version:
Shopify Admin API is a NodeJS library built to help developers easily authenticate and make calls against the Shopify API. It was inspired by and borrows heavily from ShopifySharp.
39 lines (38 loc) • 1.58 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.UsageCharges = void 0;
const infrastructure_1 = require("../infrastructure");
/**
* A service for manipulating Shopify's UsageCharges API.
*/
class UsageCharges extends infrastructure_1.BaseService {
constructor(shopDomain, accessToken) {
super(shopDomain, accessToken, "recurring_application_charges");
}
/**
* Creates a new charge.
* @param recurringChargeId The id of the recurring charge that this usage charge belongs to.
*/
create(recurringChargeId, charge) {
return this.createRequest("POST", `${recurringChargeId}/usage_charges.json`, "usage_charge", { usage_charge: charge });
}
/**
* Gets a charge with the given id.
* @param recurringChargeId The id of the recurring charge that this usage charge belongs to.
* @param id The id of the charge to get.
* @param options Options for filtering the result.
*/
get(recurringChargeId, id, options) {
return this.createRequest("GET", `${recurringChargeId}/usage_charges/${id}.json`, "usage_charge", options);
}
/**
* Retrieves a list of all charges.
* @param recurringChargeId The id of the recurring charge that this usage charge belongs to.
* @param options Options for filtering the result.
*/
list(recurringChargeId, options) {
return this.createRequest("GET", `${recurringChargeId}/usage_charges.json`, "usage_charges", options);
}
}
exports.UsageCharges = UsageCharges;
exports.default = UsageCharges;