"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.Pushsafer = void 0;

var _axios = _interopRequireDefault(require("axios"));

var _sharp = _interopRequireDefault(require("sharp"));

var _createNotificationPlatform = require("../createNotificationPlatform");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

const Pushsafer = (0, _createNotificationPlatform.createNotificationPlatform)({
  name: 'Pushsafer',
  credentialName: 'key',
  sendFunction: async args => {
    const {
      message,
      title,
      imagePath,
      credentials
    } = args;
    const params = new URLSearchParams({
      k: credentials.key,
      t: title,
      m: message
    });

    if (imagePath) {
      const image = await (0, _sharp.default)(imagePath).resize(400).toBuffer();
      params.append('p', 'data:image/jpeg;base64,' + image.toString('base64'));
    }

    await _axios.default.post('https://www.pushsafer.com/api', params);
  }
});
exports.Pushsafer = Pushsafer;
//# sourceMappingURL=pushsafer.js.map