UNPKG

@zeplin/sdk

Version:
717 lines (713 loc) 37.8 kB
"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.TextStylesApiFp = exports.TextStylesApiAxiosParamCreator = exports.TextStylesApi = 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 /** * TextStylesApi - axios parameter creator * @export */ var TextStylesApiAxiosParamCreator = function TextStylesApiAxiosParamCreator(configuration) { return { /** * List all text styles in the project\'s local styleguide * @summary Get project text styles * @param {string} projectId Project id * @param {number} [limit] Pagination limit * @param {number} [offset] Pagination offset * @param {boolean} [includeLinkedStyleguides] Whether to include linked styleguides or not * @param {*} [options] Override http request option. * @throws {RequiredError} */ getProjectTextStyles: function () { var _getProjectTextStyles = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(projectId, limit, offset, includeLinkedStyleguides) { 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 > 4 && _args[4] !== undefined ? _args[4] : {}; // verify required parameter 'projectId' is not null or undefined (0, _common.assertParamExists)('getProjectTextStyles', 'projectId', projectId); localVarPath = "/v1/projects/{project_id}/text_styles".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 _context.next = 10; return (0, _common.setOAuthToObject)(localVarHeaderParameter, "OAuth2", [], configuration); case 10: _context.next = 12; return (0, _common.setBearerAuthToObject)(localVarHeaderParameter, configuration); case 12: if (limit !== undefined) { localVarQueryParameter['limit'] = limit; } if (offset !== undefined) { localVarQueryParameter['offset'] = offset; } if (includeLinkedStyleguides !== undefined) { localVarQueryParameter['include_linked_styleguides'] = includeLinkedStyleguides; } (0, _common.setSearchParams)(localVarUrlObj, localVarQueryParameter, options.query); headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = _objectSpread(_objectSpread(_objectSpread({}, localVarHeaderParameter), headersFromBaseOptions), options.headers); return _context.abrupt("return", { url: (0, _common.toPathString)(localVarUrlObj), options: localVarRequestOptions }); case 19: case "end": return _context.stop(); } } }, _callee); })); function getProjectTextStyles(_x, _x2, _x3, _x4) { return _getProjectTextStyles.apply(this, arguments); } return getProjectTextStyles; }(), /** * Returns the text styles of the styleguide that user has access. See [Styleguide docs](#getstyleguide) for more details about how `linked_project` and `linked_styleguide` parameters can be used to retrieve resources from styleguides that user is eligible to access. * @summary Get styleguide text styles * @param {string} styleguideId Styleguide id * @param {number} [limit] Pagination limit * @param {number} [offset] Pagination offset * @param {string} [linkedProject] Reference project id * @param {string} [linkedStyleguide] Reference styleguide id * @param {boolean} [includeLinkedStyleguides] Whether to include linked styleguides or not * @param {*} [options] Override http request option. * @throws {RequiredError} */ getStyleguideTextStyles: function () { var _getStyleguideTextStyles = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(styleguideId, limit, offset, linkedProject, linkedStyleguide, includeLinkedStyleguides) { 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 > 6 && _args2[6] !== undefined ? _args2[6] : {}; // verify required parameter 'styleguideId' is not null or undefined (0, _common.assertParamExists)('getStyleguideTextStyles', 'styleguideId', styleguideId); localVarPath = "/v1/styleguides/{styleguide_id}/text_styles".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: 'GET' }, baseOptions), options); localVarHeaderParameter = {}; localVarQueryParameter = {}; // authentication OAuth2 required // oauth required _context2.next = 10; return (0, _common.setOAuthToObject)(localVarHeaderParameter, "OAuth2", [], configuration); case 10: _context2.next = 12; return (0, _common.setBearerAuthToObject)(localVarHeaderParameter, configuration); case 12: if (limit !== undefined) { localVarQueryParameter['limit'] = limit; } if (offset !== undefined) { localVarQueryParameter['offset'] = offset; } if (linkedProject !== undefined) { localVarQueryParameter['linked_project'] = linkedProject; } if (linkedStyleguide !== undefined) { localVarQueryParameter['linked_styleguide'] = linkedStyleguide; } if (includeLinkedStyleguides !== undefined) { localVarQueryParameter['include_linked_styleguides'] = includeLinkedStyleguides; } (0, _common.setSearchParams)(localVarUrlObj, localVarQueryParameter, options.query); headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = _objectSpread(_objectSpread(_objectSpread({}, localVarHeaderParameter), headersFromBaseOptions), options.headers); return _context2.abrupt("return", { url: (0, _common.toPathString)(localVarUrlObj), options: localVarRequestOptions }); case 21: case "end": return _context2.stop(); } } }, _callee2); })); function getStyleguideTextStyles(_x5, _x6, _x7, _x8, _x9, _x10) { return _getStyleguideTextStyles.apply(this, arguments); } return getStyleguideTextStyles; }(), /** * Update a text style in the project\'s local styleguide * @summary Update project text style * @param {string} projectId Project id * @param {string} textStyleId Text style id * @param {TextStyleUpdateBody} textStyleUpdateBody * @param {*} [options] Override http request option. * @throws {RequiredError} */ updateProjectTextStyle: function () { var _updateProjectTextStyle = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3(projectId, textStyleId, textStyleUpdateBody) { 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 > 3 && _args3[3] !== undefined ? _args3[3] : {}; // verify required parameter 'projectId' is not null or undefined (0, _common.assertParamExists)('updateProjectTextStyle', 'projectId', projectId); // verify required parameter 'textStyleId' is not null or undefined (0, _common.assertParamExists)('updateProjectTextStyle', 'textStyleId', textStyleId); // verify required parameter 'textStyleUpdateBody' is not null or undefined (0, _common.assertParamExists)('updateProjectTextStyle', 'textStyleUpdateBody', textStyleUpdateBody); localVarPath = "/v1/projects/{project_id}/text_styles/{text_style_id}".replace("{".concat("project_id", "}"), encodeURIComponent(String(projectId))).replace("{".concat("text_style_id", "}"), encodeURIComponent(String(textStyleId))); // 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: 'PATCH' }, baseOptions), options); localVarHeaderParameter = {}; localVarQueryParameter = {}; // authentication OAuth2 required // oauth required _context3.next = 12; return (0, _common.setOAuthToObject)(localVarHeaderParameter, "OAuth2", [], configuration); case 12: _context3.next = 14; return (0, _common.setBearerAuthToObject)(localVarHeaderParameter, configuration); case 14: 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.transformTextStyleUpdateBodyToJSON)(textStyleUpdateBody), localVarRequestOptions, configuration); return _context3.abrupt("return", { url: (0, _common.toPathString)(localVarUrlObj), options: localVarRequestOptions }); case 20: case "end": return _context3.stop(); } } }, _callee3); })); function updateProjectTextStyle(_x11, _x12, _x13) { return _updateProjectTextStyle.apply(this, arguments); } return updateProjectTextStyle; }(), /** * Update a text style in the styleguide * @summary Update styleguide text style * @param {string} styleguideId Styleguide id * @param {string} textStyleId Text style id * @param {TextStyleUpdateBody} textStyleUpdateBody * @param {*} [options] Override http request option. * @throws {RequiredError} */ updateStyleguideTextStyle: function () { var _updateStyleguideTextStyle = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee4(styleguideId, textStyleId, textStyleUpdateBody) { 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 > 3 && _args4[3] !== undefined ? _args4[3] : {}; // verify required parameter 'styleguideId' is not null or undefined (0, _common.assertParamExists)('updateStyleguideTextStyle', 'styleguideId', styleguideId); // verify required parameter 'textStyleId' is not null or undefined (0, _common.assertParamExists)('updateStyleguideTextStyle', 'textStyleId', textStyleId); // verify required parameter 'textStyleUpdateBody' is not null or undefined (0, _common.assertParamExists)('updateStyleguideTextStyle', 'textStyleUpdateBody', textStyleUpdateBody); localVarPath = "/v1/styleguides/{styleguide_id}/text_styles/{text_style_id}".replace("{".concat("styleguide_id", "}"), encodeURIComponent(String(styleguideId))).replace("{".concat("text_style_id", "}"), encodeURIComponent(String(textStyleId))); // 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: 'PATCH' }, baseOptions), options); localVarHeaderParameter = {}; localVarQueryParameter = {}; // authentication OAuth2 required // oauth required _context4.next = 12; return (0, _common.setOAuthToObject)(localVarHeaderParameter, "OAuth2", [], configuration); case 12: _context4.next = 14; return (0, _common.setBearerAuthToObject)(localVarHeaderParameter, configuration); case 14: 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.transformTextStyleUpdateBodyToJSON)(textStyleUpdateBody), localVarRequestOptions, configuration); return _context4.abrupt("return", { url: (0, _common.toPathString)(localVarUrlObj), options: localVarRequestOptions }); case 20: case "end": return _context4.stop(); } } }, _callee4); })); function updateStyleguideTextStyle(_x14, _x15, _x16) { return _updateStyleguideTextStyle.apply(this, arguments); } return updateStyleguideTextStyle; }() }; }; /** * TextStylesApi - functional programming interface * @export */ exports.TextStylesApiAxiosParamCreator = TextStylesApiAxiosParamCreator; var TextStylesApiFp = function TextStylesApiFp(configuration) { var localVarAxiosParamCreator = TextStylesApiAxiosParamCreator(configuration); return { /** * List all text styles in the project\'s local styleguide * @summary Get project text styles * @param {string} projectId Project id * @param {number} [limit] Pagination limit * @param {number} [offset] Pagination offset * @param {boolean} [includeLinkedStyleguides] Whether to include linked styleguides or not * @param {*} [options] Override http request option. * @throws {RequiredError} */ getProjectTextStyles: function getProjectTextStyles(projectId, limit, offset, includeLinkedStyleguides, options) { return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee5() { var localVarAxiosArgs; return regeneratorRuntime.wrap(function _callee5$(_context5) { while (1) { switch (_context5.prev = _context5.next) { case 0: _context5.next = 2; return localVarAxiosParamCreator.getProjectTextStyles(projectId, limit, offset, includeLinkedStyleguides, options); case 2: localVarAxiosArgs = _context5.sent; return _context5.abrupt("return", (0, _common.createRequestFunction)(localVarAxiosArgs, _axios["default"], _base.BASE_PATH, configuration)); case 4: case "end": return _context5.stop(); } } }, _callee5); }))(); }, /** * Returns the text styles of the styleguide that user has access. See [Styleguide docs](#getstyleguide) for more details about how `linked_project` and `linked_styleguide` parameters can be used to retrieve resources from styleguides that user is eligible to access. * @summary Get styleguide text styles * @param {string} styleguideId Styleguide id * @param {number} [limit] Pagination limit * @param {number} [offset] Pagination offset * @param {string} [linkedProject] Reference project id * @param {string} [linkedStyleguide] Reference styleguide id * @param {boolean} [includeLinkedStyleguides] Whether to include linked styleguides or not * @param {*} [options] Override http request option. * @throws {RequiredError} */ getStyleguideTextStyles: function getStyleguideTextStyles(styleguideId, limit, offset, linkedProject, linkedStyleguide, includeLinkedStyleguides, options) { return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee6() { var localVarAxiosArgs; return regeneratorRuntime.wrap(function _callee6$(_context6) { while (1) { switch (_context6.prev = _context6.next) { case 0: _context6.next = 2; return localVarAxiosParamCreator.getStyleguideTextStyles(styleguideId, limit, offset, linkedProject, linkedStyleguide, includeLinkedStyleguides, options); case 2: localVarAxiosArgs = _context6.sent; return _context6.abrupt("return", (0, _common.createRequestFunction)(localVarAxiosArgs, _axios["default"], _base.BASE_PATH, configuration)); case 4: case "end": return _context6.stop(); } } }, _callee6); }))(); }, /** * Update a text style in the project\'s local styleguide * @summary Update project text style * @param {string} projectId Project id * @param {string} textStyleId Text style id * @param {TextStyleUpdateBody} textStyleUpdateBody * @param {*} [options] Override http request option. * @throws {RequiredError} */ updateProjectTextStyle: function updateProjectTextStyle(projectId, textStyleId, textStyleUpdateBody, options) { return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee7() { var localVarAxiosArgs; return regeneratorRuntime.wrap(function _callee7$(_context7) { while (1) { switch (_context7.prev = _context7.next) { case 0: _context7.next = 2; return localVarAxiosParamCreator.updateProjectTextStyle(projectId, textStyleId, textStyleUpdateBody, options); case 2: localVarAxiosArgs = _context7.sent; return _context7.abrupt("return", (0, _common.createRequestFunction)(localVarAxiosArgs, _axios["default"], _base.BASE_PATH, configuration)); case 4: case "end": return _context7.stop(); } } }, _callee7); }))(); }, /** * Update a text style in the styleguide * @summary Update styleguide text style * @param {string} styleguideId Styleguide id * @param {string} textStyleId Text style id * @param {TextStyleUpdateBody} textStyleUpdateBody * @param {*} [options] Override http request option. * @throws {RequiredError} */ updateStyleguideTextStyle: function updateStyleguideTextStyle(styleguideId, textStyleId, textStyleUpdateBody, options) { return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee8() { var localVarAxiosArgs; return regeneratorRuntime.wrap(function _callee8$(_context8) { while (1) { switch (_context8.prev = _context8.next) { case 0: _context8.next = 2; return localVarAxiosParamCreator.updateStyleguideTextStyle(styleguideId, textStyleId, textStyleUpdateBody, options); case 2: localVarAxiosArgs = _context8.sent; return _context8.abrupt("return", (0, _common.createRequestFunction)(localVarAxiosArgs, _axios["default"], _base.BASE_PATH, configuration)); case 4: case "end": return _context8.stop(); } } }, _callee8); }))(); } }; }; /** * Search parameters for getProjectTextStyles operation in TextStylesApi. * @export * @interface TextStylesApiGetProjectTextStylesSearchParams */ /** * Search parameters for getStyleguideTextStyles operation in TextStylesApi. * @export * @interface TextStylesApiGetStyleguideTextStylesSearchParams */ exports.TextStylesApiFp = TextStylesApiFp; /** * TextStylesApi - object-oriented interface * @export * @class TextStylesApi * @extends {BaseAPI} */ var TextStylesApi = /*#__PURE__*/function (_BaseAPI) { _inherits(TextStylesApi, _BaseAPI); var _super = _createSuper(TextStylesApi); function TextStylesApi() { _classCallCheck(this, TextStylesApi); return _super.apply(this, arguments); } _createClass(TextStylesApi, [{ key: "getProjectTextStyles", value: ( /** * List all text styles in the project\'s local styleguide * @summary Get project text styles * @param {string} projectId Project id * @param {TextStylesApiGetProjectTextStylesSearchParams} [searchParams] Search parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof TextStylesApi */ function () { var _getProjectTextStyles2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee9(projectId) { var searchParams, options, textStylesApiFp, request, response, _args9 = arguments; return regeneratorRuntime.wrap(function _callee9$(_context9) { while (1) { switch (_context9.prev = _context9.next) { case 0: searchParams = _args9.length > 1 && _args9[1] !== undefined ? _args9[1] : {}; options = _args9.length > 2 ? _args9[2] : undefined; textStylesApiFp = TextStylesApiFp(this.configuration); _context9.next = 5; return textStylesApiFp.getProjectTextStyles(projectId, searchParams.limit, searchParams.offset, searchParams.includeLinkedStyleguides, options); case 5: request = _context9.sent; _context9.next = 8; return request(this.axios, this.basePath); case 8: response = _context9.sent; return _context9.abrupt("return", _objectSpread(_objectSpread({}, response), {}, { data: response.data.map(_models.transformJSONToTextStyle) })); case 10: case "end": return _context9.stop(); } } }, _callee9, this); })); function getProjectTextStyles(_x17) { return _getProjectTextStyles2.apply(this, arguments); } return getProjectTextStyles; }() /** * Returns the text styles of the styleguide that user has access. See [Styleguide docs](#getstyleguide) for more details about how `linked_project` and `linked_styleguide` parameters can be used to retrieve resources from styleguides that user is eligible to access. * @summary Get styleguide text styles * @param {string} styleguideId Styleguide id * @param {TextStylesApiGetStyleguideTextStylesSearchParams} [searchParams] Search parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof TextStylesApi */ ) }, { key: "getStyleguideTextStyles", value: (function () { var _getStyleguideTextStyles2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee10(styleguideId) { var searchParams, options, textStylesApiFp, request, response, _args10 = arguments; return regeneratorRuntime.wrap(function _callee10$(_context10) { while (1) { switch (_context10.prev = _context10.next) { case 0: searchParams = _args10.length > 1 && _args10[1] !== undefined ? _args10[1] : {}; options = _args10.length > 2 ? _args10[2] : undefined; textStylesApiFp = TextStylesApiFp(this.configuration); _context10.next = 5; return textStylesApiFp.getStyleguideTextStyles(styleguideId, searchParams.limit, searchParams.offset, searchParams.linkedProject, searchParams.linkedStyleguide, searchParams.includeLinkedStyleguides, options); case 5: request = _context10.sent; _context10.next = 8; return request(this.axios, this.basePath); case 8: response = _context10.sent; return _context10.abrupt("return", _objectSpread(_objectSpread({}, response), {}, { data: response.data.map(_models.transformJSONToTextStyle) })); case 10: case "end": return _context10.stop(); } } }, _callee10, this); })); function getStyleguideTextStyles(_x18) { return _getStyleguideTextStyles2.apply(this, arguments); } return getStyleguideTextStyles; }() /** * Update a text style in the project\'s local styleguide * @summary Update project text style * @param {string} projectId Project id * @param {string} textStyleId Text style id * @param {TextStyleUpdateBody} textStyleUpdateBody * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof TextStylesApi */ ) }, { key: "updateProjectTextStyle", value: (function () { var _updateProjectTextStyle2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee11(projectId, textStyleId, textStyleUpdateBody, options) { var textStylesApiFp, request, response; return regeneratorRuntime.wrap(function _callee11$(_context11) { while (1) { switch (_context11.prev = _context11.next) { case 0: textStylesApiFp = TextStylesApiFp(this.configuration); _context11.next = 3; return textStylesApiFp.updateProjectTextStyle(projectId, textStyleId, textStyleUpdateBody, options); case 3: request = _context11.sent; _context11.next = 6; return request(this.axios, this.basePath); case 6: response = _context11.sent; return _context11.abrupt("return", response); case 8: case "end": return _context11.stop(); } } }, _callee11, this); })); function updateProjectTextStyle(_x19, _x20, _x21, _x22) { return _updateProjectTextStyle2.apply(this, arguments); } return updateProjectTextStyle; }() /** * Update a text style in the styleguide * @summary Update styleguide text style * @param {string} styleguideId Styleguide id * @param {string} textStyleId Text style id * @param {TextStyleUpdateBody} textStyleUpdateBody * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof TextStylesApi */ ) }, { key: "updateStyleguideTextStyle", value: (function () { var _updateStyleguideTextStyle2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee12(styleguideId, textStyleId, textStyleUpdateBody, options) { var textStylesApiFp, request, response; return regeneratorRuntime.wrap(function _callee12$(_context12) { while (1) { switch (_context12.prev = _context12.next) { case 0: textStylesApiFp = TextStylesApiFp(this.configuration); _context12.next = 3; return textStylesApiFp.updateStyleguideTextStyle(styleguideId, textStyleId, textStyleUpdateBody, options); case 3: request = _context12.sent; _context12.next = 6; return request(this.axios, this.basePath); case 6: response = _context12.sent; return _context12.abrupt("return", response); case 8: case "end": return _context12.stop(); } } }, _callee12, this); })); function updateStyleguideTextStyle(_x23, _x24, _x25, _x26) { return _updateStyleguideTextStyle2.apply(this, arguments); } return updateStyleguideTextStyle; }()) }]); return TextStylesApi; }(_base.BaseAPI); exports.TextStylesApi = TextStylesApi;