@zeplin/sdk
Version:
Zeplin API client for JavaScript
886 lines (883 loc) • 144 kB
JavaScript
"use strict";
require("core-js/modules/es.symbol.to-primitive.js");
require("core-js/modules/es.date.to-primitive.js");
require("core-js/modules/es.symbol.js");
require("core-js/modules/es.symbol.description.js");
require("core-js/modules/es.number.constructor.js");
require("core-js/modules/es.object.define-property.js");
require("core-js/modules/es.object.keys.js");
require("core-js/modules/es.array.filter.js");
require("core-js/modules/es.object.get-own-property-descriptor.js");
require("core-js/modules/es.array.for-each.js");
require("core-js/modules/web.dom-collections.for-each.js");
require("core-js/modules/es.object.get-own-property-descriptors.js");
require("core-js/modules/es.object.define-properties.js");
require("core-js/modules/es.object.set-prototype-of.js");
require("core-js/modules/es.function.bind.js");
require("core-js/modules/es.object.get-prototype-of.js");
require("core-js/modules/es.reflect.construct.js");
require("core-js/modules/es.object.create.js");
require("core-js/modules/es.symbol.iterator.js");
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.WebhooksApiFp = exports.WebhooksApiAxiosParamCreator = exports.WebhooksApi = void 0;
require("regenerator-runtime/runtime.js");
require("core-js/modules/es.regexp.exec.js");
require("core-js/modules/es.string.replace.js");
require("core-js/modules/es.array.iterator.js");
require("core-js/modules/es.object.to-string.js");
require("core-js/modules/es.string.iterator.js");
require("core-js/modules/web.dom-collections.iterator.js");
require("core-js/modules/web.url.js");
require("core-js/modules/es.array.map.js");
require("core-js/modules/es.promise.js");
var _axios = _interopRequireDefault(require("axios"));
var _common = require("../common");
var _base = require("../base");
var _models = require("../models");
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
function _createSuper(t) { var r = _isNativeReflectConstruct(); return function () { var e, o = _getPrototypeOf(t); if (r) { var s = _getPrototypeOf(this).constructor; e = Reflect.construct(o, arguments, s); } else e = o.apply(this, arguments); return _possibleConstructorReturn(this, e); }; }
function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; } /* tslint:disable */ /* eslint-disable */ /**
* Zeplin API
* Access your resources in Zeplin
*
* Contact: support@zeplin.io
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/ // Some imports not used depending on template conditions
// @ts-ignore
// @ts-ignore
// @ts-ignore
// @ts-ignore
// @ts-ignore
// @ts-ignore
// @ts-ignore
// @ts-ignore
// @ts-ignore
// @ts-ignore
// @ts-ignore
// @ts-ignore
// @ts-ignore
// @ts-ignore
// @ts-ignore
// @ts-ignore
// @ts-ignore
// @ts-ignore
/**
* WebhooksApi - axios parameter creator
* @export
*/
var WebhooksApiAxiosParamCreator = function WebhooksApiAxiosParamCreator(configuration) {
return {
/**
* Create a webhook for the organization Wildcard `\"*\"` can be used for `project_ids` and `styleguide_ids` to receive events for all projects and styleguides that you own. You\'ll also automatically subscribe to the new ones you create in the future. Note: Users that have authorized the app before webhooks release must re-authorize the app to create webhooks.
* @summary Create organization webhooks
* @param {string} organizationId Organization id
* @param {OrganizationWebhookCreateBody} organizationWebhookCreateBody
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
createOrganizationWebhooks: function () {
var _createOrganizationWebhooks = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(organizationId, organizationWebhookCreateBody) {
var options,
localVarPath,
localVarUrlObj,
baseOptions,
localVarRequestOptions,
localVarHeaderParameter,
localVarQueryParameter,
headersFromBaseOptions,
_args = arguments;
return regeneratorRuntime.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
options = _args.length > 2 && _args[2] !== undefined ? _args[2] : {};
// verify required parameter 'organizationId' is not null or undefined
(0, _common.assertParamExists)('createOrganizationWebhooks', 'organizationId', organizationId);
// verify required parameter 'organizationWebhookCreateBody' is not null or undefined
(0, _common.assertParamExists)('createOrganizationWebhooks', 'organizationWebhookCreateBody', organizationWebhookCreateBody);
localVarPath = "/v1/organizations/{organization_id}/webhooks".replace("{".concat("organization_id", "}"), encodeURIComponent(String(organizationId))); // use dummy base URL string because the URL constructor only accepts absolute URLs.
localVarUrlObj = new URL(localVarPath, _common.DUMMY_BASE_URL);
if (configuration) {
baseOptions = configuration.baseOptions;
}
localVarRequestOptions = _objectSpread(_objectSpread({
method: 'POST'
}, baseOptions), options);
localVarHeaderParameter = {};
localVarQueryParameter = {}; // authentication OAuth2 required
// oauth required
_context.next = 11;
return (0, _common.setOAuthToObject)(localVarHeaderParameter, "OAuth2", [], configuration);
case 11:
_context.next = 13;
return (0, _common.setBearerAuthToObject)(localVarHeaderParameter, configuration);
case 13:
localVarHeaderParameter['Content-Type'] = 'application/json';
(0, _common.setSearchParams)(localVarUrlObj, localVarQueryParameter, options.query);
headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = _objectSpread(_objectSpread(_objectSpread({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
localVarRequestOptions.data = (0, _common.serializeDataIfNeeded)((0, _models.transformOrganizationWebhookCreateBodyToJSON)(organizationWebhookCreateBody), localVarRequestOptions, configuration);
return _context.abrupt("return", {
url: (0, _common.toPathString)(localVarUrlObj),
options: localVarRequestOptions
});
case 19:
case "end":
return _context.stop();
}
}
}, _callee);
}));
function createOrganizationWebhooks(_x, _x2) {
return _createOrganizationWebhooks.apply(this, arguments);
}
return createOrganizationWebhooks;
}(),
/**
* Create a webhook for the project Note: Users that have authorized the app before webhooks release must re-authorize the app to create webhooks.
* @summary Create project webhooks
* @param {string} projectId Project id
* @param {ProjectWebhookCreateBody} projectWebhookCreateBody
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
createProjectWebhooks: function () {
var _createProjectWebhooks = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(projectId, projectWebhookCreateBody) {
var options,
localVarPath,
localVarUrlObj,
baseOptions,
localVarRequestOptions,
localVarHeaderParameter,
localVarQueryParameter,
headersFromBaseOptions,
_args2 = arguments;
return regeneratorRuntime.wrap(function _callee2$(_context2) {
while (1) {
switch (_context2.prev = _context2.next) {
case 0:
options = _args2.length > 2 && _args2[2] !== undefined ? _args2[2] : {};
// verify required parameter 'projectId' is not null or undefined
(0, _common.assertParamExists)('createProjectWebhooks', 'projectId', projectId);
// verify required parameter 'projectWebhookCreateBody' is not null or undefined
(0, _common.assertParamExists)('createProjectWebhooks', 'projectWebhookCreateBody', projectWebhookCreateBody);
localVarPath = "/v1/projects/{project_id}/webhooks".replace("{".concat("project_id", "}"), encodeURIComponent(String(projectId))); // use dummy base URL string because the URL constructor only accepts absolute URLs.
localVarUrlObj = new URL(localVarPath, _common.DUMMY_BASE_URL);
if (configuration) {
baseOptions = configuration.baseOptions;
}
localVarRequestOptions = _objectSpread(_objectSpread({
method: 'POST'
}, baseOptions), options);
localVarHeaderParameter = {};
localVarQueryParameter = {}; // authentication OAuth2 required
// oauth required
_context2.next = 11;
return (0, _common.setOAuthToObject)(localVarHeaderParameter, "OAuth2", [], configuration);
case 11:
_context2.next = 13;
return (0, _common.setBearerAuthToObject)(localVarHeaderParameter, configuration);
case 13:
localVarHeaderParameter['Content-Type'] = 'application/json';
(0, _common.setSearchParams)(localVarUrlObj, localVarQueryParameter, options.query);
headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = _objectSpread(_objectSpread(_objectSpread({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
localVarRequestOptions.data = (0, _common.serializeDataIfNeeded)((0, _models.transformProjectWebhookCreateBodyToJSON)(projectWebhookCreateBody), localVarRequestOptions, configuration);
return _context2.abrupt("return", {
url: (0, _common.toPathString)(localVarUrlObj),
options: localVarRequestOptions
});
case 19:
case "end":
return _context2.stop();
}
}
}, _callee2);
}));
function createProjectWebhooks(_x3, _x4) {
return _createProjectWebhooks.apply(this, arguments);
}
return createProjectWebhooks;
}(),
/**
* Create a webhook for the styleguide Note: Users that have authorized the app before webhooks release must re-authorize the app to create webhooks.
* @summary Create styleguide webhooks
* @param {string} styleguideId Styleguide id
* @param {StyleguideWebhookCreateBody} styleguideWebhookCreateBody
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
createStyleguideWebhooks: function () {
var _createStyleguideWebhooks = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3(styleguideId, styleguideWebhookCreateBody) {
var options,
localVarPath,
localVarUrlObj,
baseOptions,
localVarRequestOptions,
localVarHeaderParameter,
localVarQueryParameter,
headersFromBaseOptions,
_args3 = arguments;
return regeneratorRuntime.wrap(function _callee3$(_context3) {
while (1) {
switch (_context3.prev = _context3.next) {
case 0:
options = _args3.length > 2 && _args3[2] !== undefined ? _args3[2] : {};
// verify required parameter 'styleguideId' is not null or undefined
(0, _common.assertParamExists)('createStyleguideWebhooks', 'styleguideId', styleguideId);
// verify required parameter 'styleguideWebhookCreateBody' is not null or undefined
(0, _common.assertParamExists)('createStyleguideWebhooks', 'styleguideWebhookCreateBody', styleguideWebhookCreateBody);
localVarPath = "/v1/styleguides/{styleguide_id}/webhooks".replace("{".concat("styleguide_id", "}"), encodeURIComponent(String(styleguideId))); // use dummy base URL string because the URL constructor only accepts absolute URLs.
localVarUrlObj = new URL(localVarPath, _common.DUMMY_BASE_URL);
if (configuration) {
baseOptions = configuration.baseOptions;
}
localVarRequestOptions = _objectSpread(_objectSpread({
method: 'POST'
}, baseOptions), options);
localVarHeaderParameter = {};
localVarQueryParameter = {}; // authentication OAuth2 required
// oauth required
_context3.next = 11;
return (0, _common.setOAuthToObject)(localVarHeaderParameter, "OAuth2", [], configuration);
case 11:
_context3.next = 13;
return (0, _common.setBearerAuthToObject)(localVarHeaderParameter, configuration);
case 13:
localVarHeaderParameter['Content-Type'] = 'application/json';
(0, _common.setSearchParams)(localVarUrlObj, localVarQueryParameter, options.query);
headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = _objectSpread(_objectSpread(_objectSpread({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
localVarRequestOptions.data = (0, _common.serializeDataIfNeeded)((0, _models.transformStyleguideWebhookCreateBodyToJSON)(styleguideWebhookCreateBody), localVarRequestOptions, configuration);
return _context3.abrupt("return", {
url: (0, _common.toPathString)(localVarUrlObj),
options: localVarRequestOptions
});
case 19:
case "end":
return _context3.stop();
}
}
}, _callee3);
}));
function createStyleguideWebhooks(_x5, _x6) {
return _createStyleguideWebhooks.apply(this, arguments);
}
return createStyleguideWebhooks;
}(),
/**
* Create a webhook for the user Wildcard `\"*\"` can be used for `project_ids` and `styleguide_ids` to receive events for all projects and styleguides that you own. You\'ll also automatically subscribe to the new ones you create in the future. Note: Users that have authorized the app before webhooks release must re-authorize the app to create webhooks.
* @summary Create user webhooks
* @param {UserWebhookCreateBody} userWebhookCreateBody
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
createUserWebhooks: function () {
var _createUserWebhooks = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee4(userWebhookCreateBody) {
var options,
localVarPath,
localVarUrlObj,
baseOptions,
localVarRequestOptions,
localVarHeaderParameter,
localVarQueryParameter,
headersFromBaseOptions,
_args4 = arguments;
return regeneratorRuntime.wrap(function _callee4$(_context4) {
while (1) {
switch (_context4.prev = _context4.next) {
case 0:
options = _args4.length > 1 && _args4[1] !== undefined ? _args4[1] : {};
// verify required parameter 'userWebhookCreateBody' is not null or undefined
(0, _common.assertParamExists)('createUserWebhooks', 'userWebhookCreateBody', userWebhookCreateBody);
localVarPath = "/v1/users/me/webhooks"; // use dummy base URL string because the URL constructor only accepts absolute URLs.
localVarUrlObj = new URL(localVarPath, _common.DUMMY_BASE_URL);
if (configuration) {
baseOptions = configuration.baseOptions;
}
localVarRequestOptions = _objectSpread(_objectSpread({
method: 'POST'
}, baseOptions), options);
localVarHeaderParameter = {};
localVarQueryParameter = {}; // authentication OAuth2 required
// oauth required
_context4.next = 10;
return (0, _common.setOAuthToObject)(localVarHeaderParameter, "OAuth2", [], configuration);
case 10:
_context4.next = 12;
return (0, _common.setBearerAuthToObject)(localVarHeaderParameter, configuration);
case 12:
localVarHeaderParameter['Content-Type'] = 'application/json';
(0, _common.setSearchParams)(localVarUrlObj, localVarQueryParameter, options.query);
headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = _objectSpread(_objectSpread(_objectSpread({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
localVarRequestOptions.data = (0, _common.serializeDataIfNeeded)((0, _models.transformUserWebhookCreateBodyToJSON)(userWebhookCreateBody), localVarRequestOptions, configuration);
return _context4.abrupt("return", {
url: (0, _common.toPathString)(localVarUrlObj),
options: localVarRequestOptions
});
case 18:
case "end":
return _context4.stop();
}
}
}, _callee4);
}));
function createUserWebhooks(_x7) {
return _createUserWebhooks.apply(this, arguments);
}
return createUserWebhooks;
}(),
/**
* Delete a webhook by id
* @summary Delete a webhook of an organization
* @param {string} organizationId Organization id
* @param {string} webhookId Webhook id
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
deleteOrganizationWebhook: function () {
var _deleteOrganizationWebhook = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee5(organizationId, webhookId) {
var options,
localVarPath,
localVarUrlObj,
baseOptions,
localVarRequestOptions,
localVarHeaderParameter,
localVarQueryParameter,
headersFromBaseOptions,
_args5 = arguments;
return regeneratorRuntime.wrap(function _callee5$(_context5) {
while (1) {
switch (_context5.prev = _context5.next) {
case 0:
options = _args5.length > 2 && _args5[2] !== undefined ? _args5[2] : {};
// verify required parameter 'organizationId' is not null or undefined
(0, _common.assertParamExists)('deleteOrganizationWebhook', 'organizationId', organizationId);
// verify required parameter 'webhookId' is not null or undefined
(0, _common.assertParamExists)('deleteOrganizationWebhook', 'webhookId', webhookId);
localVarPath = "/v1/organizations/{organization_id}/webhooks/{webhook_id}".replace("{".concat("organization_id", "}"), encodeURIComponent(String(organizationId))).replace("{".concat("webhook_id", "}"), encodeURIComponent(String(webhookId))); // use dummy base URL string because the URL constructor only accepts absolute URLs.
localVarUrlObj = new URL(localVarPath, _common.DUMMY_BASE_URL);
if (configuration) {
baseOptions = configuration.baseOptions;
}
localVarRequestOptions = _objectSpread(_objectSpread({
method: 'DELETE'
}, baseOptions), options);
localVarHeaderParameter = {};
localVarQueryParameter = {}; // authentication OAuth2 required
// oauth required
_context5.next = 11;
return (0, _common.setOAuthToObject)(localVarHeaderParameter, "OAuth2", [], configuration);
case 11:
_context5.next = 13;
return (0, _common.setBearerAuthToObject)(localVarHeaderParameter, configuration);
case 13:
(0, _common.setSearchParams)(localVarUrlObj, localVarQueryParameter, options.query);
headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = _objectSpread(_objectSpread(_objectSpread({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
return _context5.abrupt("return", {
url: (0, _common.toPathString)(localVarUrlObj),
options: localVarRequestOptions
});
case 17:
case "end":
return _context5.stop();
}
}
}, _callee5);
}));
function deleteOrganizationWebhook(_x8, _x9) {
return _deleteOrganizationWebhook.apply(this, arguments);
}
return deleteOrganizationWebhook;
}(),
/**
* Delete a webhook by id
* @summary Delete a webhook of a project
* @param {string} projectId Project id
* @param {string} webhookId Webhook id
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
deleteProjectWebhook: function () {
var _deleteProjectWebhook = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee6(projectId, webhookId) {
var options,
localVarPath,
localVarUrlObj,
baseOptions,
localVarRequestOptions,
localVarHeaderParameter,
localVarQueryParameter,
headersFromBaseOptions,
_args6 = arguments;
return regeneratorRuntime.wrap(function _callee6$(_context6) {
while (1) {
switch (_context6.prev = _context6.next) {
case 0:
options = _args6.length > 2 && _args6[2] !== undefined ? _args6[2] : {};
// verify required parameter 'projectId' is not null or undefined
(0, _common.assertParamExists)('deleteProjectWebhook', 'projectId', projectId);
// verify required parameter 'webhookId' is not null or undefined
(0, _common.assertParamExists)('deleteProjectWebhook', 'webhookId', webhookId);
localVarPath = "/v1/projects/{project_id}/webhooks/{webhook_id}".replace("{".concat("project_id", "}"), encodeURIComponent(String(projectId))).replace("{".concat("webhook_id", "}"), encodeURIComponent(String(webhookId))); // use dummy base URL string because the URL constructor only accepts absolute URLs.
localVarUrlObj = new URL(localVarPath, _common.DUMMY_BASE_URL);
if (configuration) {
baseOptions = configuration.baseOptions;
}
localVarRequestOptions = _objectSpread(_objectSpread({
method: 'DELETE'
}, baseOptions), options);
localVarHeaderParameter = {};
localVarQueryParameter = {}; // authentication OAuth2 required
// oauth required
_context6.next = 11;
return (0, _common.setOAuthToObject)(localVarHeaderParameter, "OAuth2", [], configuration);
case 11:
_context6.next = 13;
return (0, _common.setBearerAuthToObject)(localVarHeaderParameter, configuration);
case 13:
(0, _common.setSearchParams)(localVarUrlObj, localVarQueryParameter, options.query);
headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = _objectSpread(_objectSpread(_objectSpread({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
return _context6.abrupt("return", {
url: (0, _common.toPathString)(localVarUrlObj),
options: localVarRequestOptions
});
case 17:
case "end":
return _context6.stop();
}
}
}, _callee6);
}));
function deleteProjectWebhook(_x10, _x11) {
return _deleteProjectWebhook.apply(this, arguments);
}
return deleteProjectWebhook;
}(),
/**
* Delete a webhook by id
* @summary Delete a webhook of a styleguide
* @param {string} styleguideId Styleguide id
* @param {string} webhookId Webhook id
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
deleteStyleguideWebhook: function () {
var _deleteStyleguideWebhook = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee7(styleguideId, webhookId) {
var options,
localVarPath,
localVarUrlObj,
baseOptions,
localVarRequestOptions,
localVarHeaderParameter,
localVarQueryParameter,
headersFromBaseOptions,
_args7 = arguments;
return regeneratorRuntime.wrap(function _callee7$(_context7) {
while (1) {
switch (_context7.prev = _context7.next) {
case 0:
options = _args7.length > 2 && _args7[2] !== undefined ? _args7[2] : {};
// verify required parameter 'styleguideId' is not null or undefined
(0, _common.assertParamExists)('deleteStyleguideWebhook', 'styleguideId', styleguideId);
// verify required parameter 'webhookId' is not null or undefined
(0, _common.assertParamExists)('deleteStyleguideWebhook', 'webhookId', webhookId);
localVarPath = "/v1/styleguides/{styleguide_id}/webhooks/{webhook_id}".replace("{".concat("styleguide_id", "}"), encodeURIComponent(String(styleguideId))).replace("{".concat("webhook_id", "}"), encodeURIComponent(String(webhookId))); // use dummy base URL string because the URL constructor only accepts absolute URLs.
localVarUrlObj = new URL(localVarPath, _common.DUMMY_BASE_URL);
if (configuration) {
baseOptions = configuration.baseOptions;
}
localVarRequestOptions = _objectSpread(_objectSpread({
method: 'DELETE'
}, baseOptions), options);
localVarHeaderParameter = {};
localVarQueryParameter = {}; // authentication OAuth2 required
// oauth required
_context7.next = 11;
return (0, _common.setOAuthToObject)(localVarHeaderParameter, "OAuth2", [], configuration);
case 11:
_context7.next = 13;
return (0, _common.setBearerAuthToObject)(localVarHeaderParameter, configuration);
case 13:
(0, _common.setSearchParams)(localVarUrlObj, localVarQueryParameter, options.query);
headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = _objectSpread(_objectSpread(_objectSpread({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
return _context7.abrupt("return", {
url: (0, _common.toPathString)(localVarUrlObj),
options: localVarRequestOptions
});
case 17:
case "end":
return _context7.stop();
}
}
}, _callee7);
}));
function deleteStyleguideWebhook(_x12, _x13) {
return _deleteStyleguideWebhook.apply(this, arguments);
}
return deleteStyleguideWebhook;
}(),
/**
* Delete a webhook by id
* @summary Delete a webhook of a user
* @param {string} webhookId Webhook id
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
deleteUserWebhook: function () {
var _deleteUserWebhook = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee8(webhookId) {
var options,
localVarPath,
localVarUrlObj,
baseOptions,
localVarRequestOptions,
localVarHeaderParameter,
localVarQueryParameter,
headersFromBaseOptions,
_args8 = arguments;
return regeneratorRuntime.wrap(function _callee8$(_context8) {
while (1) {
switch (_context8.prev = _context8.next) {
case 0:
options = _args8.length > 1 && _args8[1] !== undefined ? _args8[1] : {};
// verify required parameter 'webhookId' is not null or undefined
(0, _common.assertParamExists)('deleteUserWebhook', 'webhookId', webhookId);
localVarPath = "/v1/users/me/webhooks/{webhook_id}".replace("{".concat("webhook_id", "}"), encodeURIComponent(String(webhookId))); // use dummy base URL string because the URL constructor only accepts absolute URLs.
localVarUrlObj = new URL(localVarPath, _common.DUMMY_BASE_URL);
if (configuration) {
baseOptions = configuration.baseOptions;
}
localVarRequestOptions = _objectSpread(_objectSpread({
method: 'DELETE'
}, baseOptions), options);
localVarHeaderParameter = {};
localVarQueryParameter = {}; // authentication OAuth2 required
// oauth required
_context8.next = 10;
return (0, _common.setOAuthToObject)(localVarHeaderParameter, "OAuth2", [], configuration);
case 10:
_context8.next = 12;
return (0, _common.setBearerAuthToObject)(localVarHeaderParameter, configuration);
case 12:
(0, _common.setSearchParams)(localVarUrlObj, localVarQueryParameter, options.query);
headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = _objectSpread(_objectSpread(_objectSpread({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
return _context8.abrupt("return", {
url: (0, _common.toPathString)(localVarUrlObj),
options: localVarRequestOptions
});
case 16:
case "end":
return _context8.stop();
}
}
}, _callee8);
}));
function deleteUserWebhook(_x14) {
return _deleteUserWebhook.apply(this, arguments);
}
return deleteUserWebhook;
}(),
/**
* Get a webhook by id
* @summary Get a webhook of organization
* @param {string} organizationId Organization id
* @param {string} webhookId Webhook id
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getOrganizationWebhook: function () {
var _getOrganizationWebhook = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee9(organizationId, webhookId) {
var options,
localVarPath,
localVarUrlObj,
baseOptions,
localVarRequestOptions,
localVarHeaderParameter,
localVarQueryParameter,
headersFromBaseOptions,
_args9 = arguments;
return regeneratorRuntime.wrap(function _callee9$(_context9) {
while (1) {
switch (_context9.prev = _context9.next) {
case 0:
options = _args9.length > 2 && _args9[2] !== undefined ? _args9[2] : {};
// verify required parameter 'organizationId' is not null or undefined
(0, _common.assertParamExists)('getOrganizationWebhook', 'organizationId', organizationId);
// verify required parameter 'webhookId' is not null or undefined
(0, _common.assertParamExists)('getOrganizationWebhook', 'webhookId', webhookId);
localVarPath = "/v1/organizations/{organization_id}/webhooks/{webhook_id}".replace("{".concat("organization_id", "}"), encodeURIComponent(String(organizationId))).replace("{".concat("webhook_id", "}"), encodeURIComponent(String(webhookId))); // use dummy base URL string because the URL constructor only accepts absolute URLs.
localVarUrlObj = new URL(localVarPath, _common.DUMMY_BASE_URL);
if (configuration) {
baseOptions = configuration.baseOptions;
}
localVarRequestOptions = _objectSpread(_objectSpread({
method: 'GET'
}, baseOptions), options);
localVarHeaderParameter = {};
localVarQueryParameter = {}; // authentication OAuth2 required
// oauth required
_context9.next = 11;
return (0, _common.setOAuthToObject)(localVarHeaderParameter, "OAuth2", [], configuration);
case 11:
_context9.next = 13;
return (0, _common.setBearerAuthToObject)(localVarHeaderParameter, configuration);
case 13:
(0, _common.setSearchParams)(localVarUrlObj, localVarQueryParameter, options.query);
headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = _objectSpread(_objectSpread(_objectSpread({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
return _context9.abrupt("return", {
url: (0, _common.toPathString)(localVarUrlObj),
options: localVarRequestOptions
});
case 17:
case "end":
return _context9.stop();
}
}
}, _callee9);
}));
function getOrganizationWebhook(_x15, _x16) {
return _getOrganizationWebhook.apply(this, arguments);
}
return getOrganizationWebhook;
}(),
/**
* List all webhooks of organization Note: Zeplin apps can only list the webhook that are created by them. To list all webhooks created by any app or without app, personal access token is needed.
* @summary Get organization webhooks
* @param {string} organizationId Organization id
* @param {number} [limit] Pagination limit
* @param {number} [offset] Pagination offset
* @param {WebhookStatusEnum} [status] Filter by webhook status
* @param {WebhookHealthEnum} [urlHealth] Filter by health of webhook\'s URL
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getOrganizationWebhooks: function () {
var _getOrganizationWebhooks = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee10(organizationId, limit, offset, status, urlHealth) {
var options,
localVarPath,
localVarUrlObj,
baseOptions,
localVarRequestOptions,
localVarHeaderParameter,
localVarQueryParameter,
headersFromBaseOptions,
_args10 = arguments;
return regeneratorRuntime.wrap(function _callee10$(_context10) {
while (1) {
switch (_context10.prev = _context10.next) {
case 0:
options = _args10.length > 5 && _args10[5] !== undefined ? _args10[5] : {};
// verify required parameter 'organizationId' is not null or undefined
(0, _common.assertParamExists)('getOrganizationWebhooks', 'organizationId', organizationId);
localVarPath = "/v1/organizations/{organization_id}/webhooks".replace("{".concat("organization_id", "}"), encodeURIComponent(String(organizationId))); // use dummy base URL string because the URL constructor only accepts absolute URLs.
localVarUrlObj = new URL(localVarPath, _common.DUMMY_BASE_URL);
if (configuration) {
baseOptions = configuration.baseOptions;
}
localVarRequestOptions = _objectSpread(_objectSpread({
method: 'GET'
}, baseOptions), options);
localVarHeaderParameter = {};
localVarQueryParameter = {}; // authentication OAuth2 required
// oauth required
_context10.next = 10;
return (0, _common.setOAuthToObject)(localVarHeaderParameter, "OAuth2", [], configuration);
case 10:
_context10.next = 12;
return (0, _common.setBearerAuthToObject)(localVarHeaderParameter, configuration);
case 12:
if (limit !== undefined) {
localVarQueryParameter['limit'] = limit;
}
if (offset !== undefined) {
localVarQueryParameter['offset'] = offset;
}
if (status !== undefined) {
localVarQueryParameter['status'] = status;
}
if (urlHealth !== undefined) {
localVarQueryParameter['url_health'] = urlHealth;
}
(0, _common.setSearchParams)(localVarUrlObj, localVarQueryParameter, options.query);
headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = _objectSpread(_objectSpread(_objectSpread({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
return _context10.abrupt("return", {
url: (0, _common.toPathString)(localVarUrlObj),
options: localVarRequestOptions
});
case 20:
case "end":
return _context10.stop();
}
}
}, _callee10);
}));
function getOrganizationWebhooks(_x17, _x18, _x19, _x20, _x21) {
return _getOrganizationWebhooks.apply(this, arguments);
}
return getOrganizationWebhooks;
}(),
/**
* Get a webhook by id
* @summary Get a webhook of project
* @param {string} projectId Project id
* @param {string} webhookId Webhook id
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getProjectWebhook: function () {
var _getProjectWebhook = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee11(projectId, webhookId) {
var options,
localVarPath,
localVarUrlObj,
baseOptions,
localVarRequestOptions,
localVarHeaderParameter,
localVarQueryParameter,
headersFromBaseOptions,
_args11 = arguments;
return regeneratorRuntime.wrap(function _callee11$(_context11) {
while (1) {
switch (_context11.prev = _context11.next) {
case 0:
options = _args11.length > 2 && _args11[2] !== undefined ? _args11[2] : {};
// verify required parameter 'projectId' is not null or undefined
(0, _common.assertParamExists)('getProjectWebhook', 'projectId', projectId);
// verify required parameter 'webhookId' is not null or undefined
(0, _common.assertParamExists)('getProjectWebhook', 'webhookId', webhookId);
localVarPath = "/v1/projects/{project_id}/webhooks/{webhook_id}".replace("{".concat("project_id", "}"), encodeURIComponent(String(projectId))).replace("{".concat("webhook_id", "}"), encodeURIComponent(String(webhookId))); // use dummy base URL string because the URL constructor only accepts absolute URLs.
localVarUrlObj = new URL(localVarPath, _common.DUMMY_BASE_URL);
if (configuration) {
baseOptions = configuration.baseOptions;
}
localVarRequestOptions = _objectSpread(_objectSpread({
method: 'GET'
}, baseOptions), options);
localVarHeaderParameter = {};
localVarQueryParameter = {}; // authentication OAuth2 required
// oauth required
_context11.next = 11;
return (0, _common.setOAuthToObject)(localVarHeaderParameter, "OAuth2", [], configuration);
case 11:
_context11.next = 13;
return (0, _common.setBearerAuthToObject)(localVarHeaderParameter, configuration);
case 13:
(0, _common.setSearchParams)(localVarUrlObj, localVarQueryParameter, options.query);
headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = _objectSpread(_objectSpread(_objectSpread({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
return _context11.abrupt("return", {
url: (0, _common.toPathString)(localVarUrlObj),
options: localVarRequestOptions
});
case 17:
case "end":
return _context11.stop();
}
}
}, _callee11);
}));
function getProjectWebhook(_x22, _x23) {
return _getProjectWebhook.apply(this, arguments);
}
return getProjectWebhook;
}(),
/**
* List all webhooks of the project Note: Zeplin apps can only list the webhook that are created by them. To list all webhooks created by any app or without app, personal access token is needed.
* @summary Get project webhooks
* @param {string} projectId Project id
* @param {number} [limit] Pagination limit
* @param {number} [offset] Pagination offset
* @param {WebhookStatusEnum} [status] Filter by webhook status
* @param {WebhookHealthEnum} [urlHealth] Filter by health of webhook\'s URL
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getProjectWebhooks: function () {
var _getProjectWebhooks = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee12(projectId, limit, offset, status, urlHealth) {
var options,
localVarPath,
localVarUrlObj,
baseOptions,
localVarRequestOptions,
localVarHeaderParameter,
localVarQueryParameter,
headersFromBaseOptions,
_args12 = arguments;
return regeneratorRuntime.wrap(function _callee12$(_context12) {
while (1) {
switch (_context12.prev = _context12.next) {
case 0:
options = _args12.length > 5 && _args12[5] !== undefined ? _args12[5] : {};
// verify required parameter 'projectId' is not null or undefined
(0, _common.assertParamExists)('getProjectWebhooks', 'projectId', projectId);
localVarPath = "/v1/projects/{project_id}/webhooks".replace("{".concat("project_id", "}"), encodeURIComponent(String(projectId))); // use dummy base URL string because the URL constructor only accepts absolute URLs.
localVarUrlObj = new URL(localVarPath, _common.DUMMY_BASE_URL);
if (configuration) {
baseOptions = configuration.baseOptions;
}
localVarRequestOptions = _objectSpread(_objectSpread({
method: 'GET'
}, baseOptions), options);
localVarHeaderParameter = {};
localVarQueryParameter = {}; // authentication OAuth2 required
// oauth required
_context12.next = 10;
return (0, _common.setOAuthToObject)(localVarHeaderParameter, "OAuth2", [], configuration);
case 10:
_context12.next = 12;
return (0, _common.setBearerAuthToObject)(localVarHeaderParameter, configuration);
case 12:
if (limit !== undefined) {
localVarQueryParameter['limit'] = limit;
}
if (offset !== undefined) {
localVarQueryParameter['offset'] = offset;
}
if (status !== undefined) {
localVarQueryParameter['status'] = status;
}
if (urlHealth !== undefined) {
localVarQueryParameter['url_health'] = urlHealth;
}
(0, _common.setSearchParams)(localVarUrlObj, localVarQueryParameter, options.query);
headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = _objectSpread(_objectSpread(_objectSpread({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
return _context12.abrupt("return", {
url: (0, _common.toPathString)(localVarUrlObj),
options: localVarRequestOptions
});
case 20:
case "end":
return _context12.stop();
}
}
}, _callee12);
}));
function getProjectWebhooks(_x24, _x25, _x26, _x27, _x28) {
return _getProjectWebhooks.apply(this, argumen