Skip to content

Commit 71a476b

Browse files
committed
Workflow implementation and Unit test done
1 parent 7bf1c5c commit 71a476b

File tree

6 files changed

+563
-17
lines changed

6 files changed

+563
-17
lines changed

lib/organization/index.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import cloneDeep from 'lodash/cloneDeep'
22
import error from '../core/contentstackError'
33
import { fetch } from '../entity'
44
import ContentstackCollection from '../contentstackCollection'
5-
import { RoleCollection } from '../stack/roles/index'
6-
import { StackCollection } from '../stack/index'
5+
import { RoleCollection } from '../stack/roles'
6+
import { StackCollection } from '../stack'
77
import { UserCollection } from '../user'
88
/**
99
* Organization is the top-level entity in the hierarchy of Contentstack, consisting of stacks and stack resources, and users. Organization allows easy management of projects as well as users within the Organization. Read more about <a href='https://www.contentstack.com/docs/guide/organization'>Organizations.</a>.
@@ -37,10 +37,10 @@ export function Organization (http, data) {
3737
* @description The Get all stacks in an organization call fetches the list of all stacks in an Organization.
3838
* @memberof Organization
3939
* @func stacks
40-
* @param {Int} limit The limit parameter will return a specific number of roles in the output.
41-
* @param {Int} skip The skip parameter will skip a specific number of roles in the output.
42-
* @param {String} asc When fetching roles, you can sort them in the ascending order with respect to the value of a specific field in the response body.
43-
* @param {String} desc When fetching roles, you can sort them in the decending order with respect to the value of a specific field in the response body.
40+
* @param {Int} limit The limit parameter will return a specific number of stacks in the output.
41+
* @param {Int} skip The skip parameter will skip a specific number of stacks in the output.
42+
* @param {String} asc When fetching stacks, you can sort them in the ascending order with respect to the value of a specific field in the response body.
43+
* @param {String} desc When fetching stacks, you can sort them in the decending order with respect to the value of a specific field in the response body.
4444
* @param {Boolean} include_count To retrieve the count of stack.
4545
* @param {String} typeahead The type head contains value to be included in search.
4646
* @returns {ContentstackCollection} Instance of ContentstackCollection.
@@ -207,12 +207,12 @@ export function Organization (http, data) {
207207
* @description The Get all organizations call lists all organizations related to the system user in the order that they were created.
208208
* @memberof Organization
209209
* @func fetchAll
210-
* @param {Int} limit The limit parameter will return a specific number of roles in the output.
211-
* @param {Int} skip The skip parameter will skip a specific number of roles in the output.
212-
* @param {String} asc When fetching roles, you can sort them in the ascending order with respect to the value of a specific field in the response body.
213-
* @param {String} desc When fetching roles, you can sort them in the decending order with respect to the value of a specific field in the response body.
214-
* @param {Boolean}include_count To retrieve the count of roles.
215-
* @param {String} typeahead The type head contains value to be included in search.
210+
* @param {Int} limit TThe ‘limit parameter will return a specific number of organizations in the output.
211+
* @param {Int} skip The skip parameter will skip a specific number of organizations in the output.
212+
* @param {String} asc The ‘asc’ parameter allows you to sort the list of organizations in the ascending order with respect to the value of a specific field.
213+
* @param {String} desc The ‘desc’ parameter allows you to sort the list of Organizations in the descending order with respect to the value of a specific field.
214+
* @param {Boolean}include_count The ‘include_count’ parameter returns the total number of organizations related to the user.
215+
* @param {String} typeahead The typeahead parameter is a type of filter that allows you to perform a name-based search on all organizations based on the value provided.
216216
* @returns {ContentstackCollection} Result collection of content of specified module.
217217
* @example
218218
* import * as contentstack from '@contentstack/management'

lib/stack/index.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { Asset } from './asset'
1111
import { Locale } from './locale'
1212
import { Extension } from './extension'
1313
import { Webhook } from './webhook'
14+
import { Workflow } from './workflow'
1415
import { Release } from './release'
1516
import { BulkOperation } from './bulkOperation'
1617
import { Label } from './label'
@@ -221,6 +222,29 @@ export function Stack (http, data) {
221222
return new Extension(http, data)
222223
}
223224

225+
226+
/**
227+
* @description Workflow 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.
228+
* @param {String} workflowUid The UID of the Workflow you want to get details.
229+
* @returns {Workflow} Instace of Workflow.
230+
* @example
231+
* import * as contentstack from '@contentstack/management'
232+
* const client = contentstack.client()
233+
*
234+
* client.stack({ api_key: 'api_key'}).workflow().create()
235+
* .then((workflow) => console.log(workflow))
236+
*
237+
* client.stack({ api_key: 'api_key'}).workflow('workflow_uid').fetch()
238+
* .then((workflow) => console.log(workflow))
239+
*/
240+
this.workflow = (workflowUid = null) => {
241+
const data = { stackHeaders: this.stackHeaders }
242+
if (workflowUid) {
243+
data.workflow = { uid: workflowUid }
244+
}
245+
return new Workflow(http, data)
246+
}
247+
224248
/**
225249
* @description Webhooks allow you to specify a URL to which you would like Contentstack to post data when an event happens.
226250
* @param {String} webhookUid The UID of the Webhook you want to get details.

lib/stack/webhook/index.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -165,11 +165,11 @@ export function Webhook (http, data = {}) {
165165
* @description The Get all Webhook call lists all Webhooks from Stack.
166166
* @memberof Webhook
167167
* @func fetchAll
168-
* @param {Int} limit The limit parameter will return a specific number of roles in the output.
169-
* @param {Int} skip The skip parameter will skip a specific number of roles in the output.
170-
* @param {String} asc When fetching roles, you can sort them in the ascending order with respect to the value of a specific field in the response body.
171-
* @param {String} desc When fetching roles, you can sort them in the decending order with respect to the value of a specific field in the response body.
172-
* @param {Boolean}include_count To retrieve the count of roles.
168+
* @param {Int} limit The limit parameter will return a specific number of webhooks in the output.
169+
* @param {Int} skip The skip parameter will skip a specific number of webhooks in the output.
170+
* @param {String} asc When fetching webhooks, you can sort them in the ascending order with respect to the value of a specific field in the response body.
171+
* @param {String} desc When fetching webhooks, you can sort them in the decending order with respect to the value of a specific field in the response body.
172+
* @param {Boolean}include_count To retrieve the count of webhooks.
173173
* @returns {ContentstackCollection} Result collection of content of specified module.
174174
* @example
175175
* import * as contentstack from '@contentstack/management'

0 commit comments

Comments
 (0)