@@ -3,10 +3,9 @@ import {
33 create ,
44 update ,
55 deleteEntity ,
6- fetch
6+ fetch ,
7+ fetchAll
78} from '../../../entity'
8- import error from '../../../core/contentstackError'
9- import ContentstackCollection from '../../../contentstackCollection'
109
1110/**
1211 * PublishRules is a tool that allows you to streamline the process of content creation and publishing, and lets you manage the content lifecycle of your project smoothly. Read more about <a href='https://www.contentstack.com/docs/developers/set-up-publish ruless-and-publish-rules'>PublishRuless and Publish Rules</a>.
@@ -80,17 +79,17 @@ export function PublishRules (http, data = {}) {
8079 * import * as contentstack from '@contentstack/management'
8180 * const client = contentstack.client()
8281 * const publishing_rule = {
83- * "publish rules": "publish rules_uid",
82+ * "publish rules": "publish rules_uid",
8483 * "actions": [],
8584 * "content_types": ["$all"],
8685 * "locales": ["en-us"],
8786 * "environment": "environment_uid",
88- * "approvers": {
89- * "users": ["user_uid"],
90- * "roles": ["role_uid"]
87+ * "approvers": {
88+ * "users": ["user_uid"],
89+ * "roles": ["role_uid"]
9190 * },
9291 * "publish rules_stage": "publish rules_stage_uid",
93- * "disable_approver_publishing": false
92+ * "disable_approver_publishing": false
9493 * }
9594 * client.stack().publishRules().create({ publishing_rule })
9695 * .then((publishRules) => console.log(publishRules))
@@ -102,9 +101,9 @@ export function PublishRules (http, data = {}) {
102101 * @memberof Publish Rules
103102 * @func fetchAll
104103 * @param {String } content_types Enter a comma-separated list of content type UIDs for filtering publish rules on its basis.
105- * @param {Int } limit The limit parameter will return a specific number of Publish Ruless in the output.
106- * @param {Int } skip The skip parameter will skip a specific number of Publish Ruless in the output.
107- * @param {Boolean }include_count To retrieve the count of Publish Ruless .
104+ * @param {Int } limit The limit parameter will return a specific number of Publish Rules in the output.
105+ * @param {Int } skip The skip parameter will skip a specific number of Publish Rules in the output.
106+ * @param {Boolean }include_count To retrieve the count of Publish Rules .
108107 * @returns {ContentstackCollection } Result collection of content of specified module.
109108 * @example
110109 * import * as contentstack from '@contentstack/management'
@@ -114,27 +113,7 @@ export function PublishRules (http, data = {}) {
114113 * .then((collection) => console.log(collection))
115114 *
116115 */
117- this . fetchAll = async ( params ) => {
118- const headers = { }
119- if ( this . stackHeaders ) {
120- headers . headers = this . stackHeaders
121- }
122- if ( params ) {
123- headers . params = {
124- ...cloneDeep ( params )
125- }
126- }
127- try {
128- const response = await http . get ( this . urlPath , headers )
129- if ( response . data ) {
130- return new ContentstackCollection ( response , http , null , PublishRulesCollection )
131- } else {
132- throw error ( response )
133- }
134- } catch ( err ) {
135- throw error ( err )
136- }
137- }
116+ this . fetchAll = fetchAll ( http , PublishRulesCollection )
138117 }
139118}
140119
0 commit comments