"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.subscribe = subscribe;
exports.createSubscription = createSubscription;
exports.getSubscriptions = getSubscriptions;
exports.getSubscription = getSubscription;
exports.updateSubscription = updateSubscription;
const authenticate_request_1 = require("./utils/authenticate-request");
const orval_newsletters_1 = require("./orval/api/orval-newsletters");
/**
 * create a subscription for user (existing or not) to a newsletter
 *
 * @param {ISubscribeParams} options
 * @return {Promise<ISubscription>}
 */
async function subscribe(options) {
    options.token = await (0, authenticate_request_1.authenticateRequest)(options);
    return (0, orval_newsletters_1.subscribe)(options.data, options);
}
/**
 * create a subscription for user (existing) to a newsletter
 *
 * @param {ICreateSubscriptionParams} options
 * @return {Promise<ISubscription>}
 */
async function createSubscription(options) {
    options.token = await (0, authenticate_request_1.authenticateRequest)(options);
    return (0, orval_newsletters_1.createSubscription)(options.data, options);
}
/**
 * get subscriptions
 *
 * @param {IGetSubscriptionsParams} options
 * @return {Promise<ISubscription[]>}
 */
async function getSubscriptions(options) {
    options.token = await (0, authenticate_request_1.authenticateRequest)(options);
    return (0, orval_newsletters_1.getSubscriptions)(options.data, options);
}
/**
 * get a subscription
 *
 * @param {IGetSubscriptionParams} options
 * @return {Promise<ISubscription>}
 */
async function getSubscription(options) {
    options.token = await (0, authenticate_request_1.authenticateRequest)(options);
    return (0, orval_newsletters_1.getSubscription)(options.subscriptionId, options);
}
/**
 * update a subscription
 *
 * @param {IUpdateSubscriptionParams} options
 * @return {Promise<ISubscription>}
 */
async function updateSubscription(options) {
    options.token = await (0, authenticate_request_1.authenticateRequest)(options);
    return (0, orval_newsletters_1.updateSubscription)(options.subscriptionId, options.data, options);
}
//# sourceMappingURL=subscriptions.js.map